<?php

/**
 * @author Rizky Tahara Shita
 * @website http://tahara.web.id
 * @email rizky.tahara@gmail.com
 * @copyright b'IT Cyber Solution
 */

require_once(APPPATH.'controllers/admin/applications.php');
class Profile extends Applications
{
	public function __construct()
	{
		parent::__construct();

		/**
		 * @description check the session variables
		 */
		$this->M_login->session_check();

		/**
		 * @description the URL
		 */
		$this->bz_segment['END'] = 5;
		$this->bz_segment['MASTER_DATA'] = $this->uri->segment($this->bz_segment['END'], '');
		$this->bz_segment['URL'] = $this->M_functions->segment_create(FALSE, '/'.$this->bz_segment['MASTER_DATA']);
		$this->bz_segment['SITE_URL'] = site_url($this->bz_segment['URL']);

		/**
		 * @description access rights
		 */
		$this->access_rights = $this->M_menu->valid_check('db_default', $this->session->userdata('session_user_id'));
		$this->access_rights = array
			(
				'ADD' => in_array('add', $this->access_rights) ? TRUE : FALSE
				, 'EDIT' => in_array('edit', $this->access_rights) ? TRUE : FALSE
				, 'DELETE' => in_array('delete', $this->access_rights) ? TRUE : FALSE
			);

		/**
		 * @description define the form type
		 */
		$form_type = explode('_', $this->bz_segment['MASTER_DATA']);
		$this->form = array
			(
				'REPLACE' => array
					(
						'TYPE' => array('personal_', 'list_')
						, 'WITH' => array('_form_', '_form_')
						, 'WITH_MODAL' => array('form_modal_', 'form_modal_')
					)
			);
		$this->form = array
			(
				'TYPE' => $form_type[0]
				, 'MODEL' => 'MODALDIALOG'
				, 'NAME' => str_replace($this->form['REPLACE']['TYPE'], $this->form['REPLACE']['WITH'], $this->bz_segment['MASTER_DATA'])
				, 'NAME_MODAL' => str_replace($this->form['REPLACE']['TYPE'], $this->form['REPLACE']['WITH_MODAL'], $this->bz_segment['MASTER_DATA'])
				, 'JAVASCRIPT' => array('HEADER' => '', 'MODAL' => '')
			);

		/**
		 * @description initialize variables for database
		 */
		switch ($this->form['NAME'])
		{
			case '_form_employee':
				$this->form['MODEL'] = 'VIEW';
				$this->tbl_attr = array
					(
						'TABLE' => array
							(
								'NAME' => 'hris_employee_company'
								, 'PRIMARY' => array
									(
										'SHOW' => FALSE
										, 'DATA' => array('data__id')
									)
							)
						, 'VIEW' => array
							(
								'HEADING' => array
									(
										$this->lang->line('hris_employee_number')
										, $this->lang->line('hris_employee_name_official')
										, $this->lang->line('hris_schema_department')
										, $this->lang->line('hris_schema_position')
										, $this->lang->line('hris_employee_effective_date')
										, $this->lang->line('hris_job_status')
										, $this->access_rights['DELETE'] ? '&nbsp;' : NULL
									)
								, 'FIELDS' => 'data__id, number, (select name_official from bz_hris_employee_data b where b.id = bz_hris_employee_company.data__id) as name_official'
										. ', (select @_hidden__company_structure := `fn_hris_organization_company_structure_generate_nested`(bz_hris_employee_company.structure__id)) as hidden__company_structure'
										. ', substring_index(@_hidden__company_structure, ";", -1) as structure_department_name'
										. ', (select name from bz_hris_organization_company_structure c where c.id = bz_hris_employee_company.structure__id) as structure_position_name'
										. ', date_format(effective_date, "%d %M %Y") as effective_date'
										. ', `fn_hris_master_data_get_name`(27, job_status__id, "'.$this->session->userdata('session_user_language_id').'") as job_status_name'
								, 'FIELDS_EDIT' => 'name_official'
								, 'FIELDS_ORDER' => 'name_official'
								, 'TOT_ROW' => $this->web_data['BISKITZ']['SETTINGS']['BISKITZ_VIEW_TOT_ROW']
								, 'TABLE' => array
									(
										'WHERE' => array()
									)
							)
					);
				break;


			/**
			 * @section employee information
			 */
			case '_form_information_summary':
				/**
				 * TODO: change this form when the employee job mapping already done! meanwhile; we show the personal_data :)
				 */

			case '_form_information_data':
				$this->form['MODEL'] = 'STANDARD';
				$this->tbl_attr = array
					(
						'TABLE' => array
							(
								'NAME' => 'hris_employee_data'
								, 'PRIMARY' => array
									(
										'SHOW' => FALSE
										, 'DATA' => array('id')
									)
							)
						, 'FORM' => array
							(
								'FIELDS' => 'id, `fn_hris_employee_number_current`(id), name_first, name_middle, name_last, name_official, name_nick, salutation__id, nationality__id'
									. ', concat("ajax_call::", "'.$this->bz_segment['SITE_URL'].'", "::ajx_live_area_::combo_put::NULL/47/11/::", birth_place_city__id) as birth_place'
									. ', birth_date, gender__id, religion__id, marital_status__id, marital_place, marital_date, id_card_number, id_card_expire, tax_id, tax_type__id, finger_id'
								, 'FIELDS_ORDER' => ''
								, 'COLUMN' => 4
								, 'COLUMN_JOIN' => 2
							)
					);

				$this->form['JAVASCRIPT']['HEADER'] =
					'
						$("#txt4, #txt5, #txt6").keyup
							(function()
							{
								$("#txt7").val( $("#txt4").val() + " " + $("#txt5").val() + " " + $("#txt6").val() );
							});

						js_datetime_picker_show("txt12", "txt13");
						js_datetime_picker_show("txt17", "txt18");
						js_datetime_picker_show("txt19", "txt20");
					';
				break;

			case '_form_information_address':
				$this->tbl_attr = array
					(
						'TABLE_MODAL' => array
							(
								'NAME' => 'hris_employee_address'
								, 'NAME_ALIAS' => 'hris_employee_address b'
								, 'PRIMARY' => array
									(
										'SHOW' => FALSE
										, 'DATA' => array('id', 'data__id')
									)
							)
						, 'VIEW_DETAIL' => array
							(
								'HEADING' => array
									(
										$this->lang->line('hris_address')
										, $this->lang->line('hris_employee_address_rt')
										, $this->lang->line('hris_employee_address_rw')
										, $this->lang->line('hris_zipcode')
										, $this->lang->line('hris_phone')
										, $this->lang->line('hris_employee_address_distance')
										, $this->lang->line('hris_status')
										, $this->access_rights['DELETE'] ? '&nbsp;' : NULL
									)
								, 'FIELDS' => 'id, data__id, address, rt, rw, zipcode, phone, distance, status'
								, 'FIELDS_EDIT' => 'address'
								, 'FIELDS_ORDER' => 'id'
							)
						, 'FORM_MODAL' => array
							(
								'HEADING' => $this->lang->line('hris_modal')
								, 'FIELDS' => 'id, data__id, address, rt, rw'
									. ', country__id'
									. ', concat("ajax_call::", "'.$this->bz_segment['SITE_URL'].'", "::ajx_live_area_::combo_put::", country__id, "/46/76/::", province__id) as province_id'
									. ', concat("ajax_call::", "'.$this->bz_segment['SITE_URL'].'", "::ajx_live_area_::combo_put::", province__id, "/47/77/::", city__id) as city_id'
									. ', concat("ajax_call::", "'.$this->bz_segment['SITE_URL'].'", "::ajx_live_area_::combo_put::", city__id, "/48/78/::", regency__id) as regency_id'
									. ', concat("ajax_call::", "'.$this->bz_segment['SITE_URL'].'", "::ajx_live_area_::combo_put::", regency__id, "/49/79/::", sub_district__id) as sub_district_id'
									. ', zipcode, phone, ownership__id, stayed_status__id, distance'
									. ', (case status when "Current" then "'.$this->lang->line('hris_current').'" else "'.$this->lang->line('hris_not_available').'" end) as status'
								, 'FIELDS_ORDER' => ''
								, 'COLUMN' => 4
								, 'COLUMN_JOIN' => 2
							)
					);

				$this->form['JAVASCRIPT']['MODAL'] =
					'
						$(\"#txt75\").change(function()
							{
								$(\"#txt76, #txt77, #txt78, #txt79\").empty()
									.append( $(\"<option></option>\").val(\"\").html(\"'.$this->lang->line('hris_choose').'\") );

								if ($(this).val() != \"\")
								{
									js_form_action
									(
										\"'.$this->bz_segment['SITE_URL'].'\", \"ajx_live_area_\", \"combo_put\", $(this).val() + \"/46/76\"
										, \"#frm_modal\", \"#process_modaldialog\", \"#error_message_modaldialog\"
									);
								}
							}
						);

						$(\"#txt76\").change(function()
							{
								$(\"#txt77, #txt78, #txt79\").empty()
									.append( $(\"<option></option>\").val(\"\").html(\"'.$this->lang->line('hris_choose').'\") );

								if ($(this).val() != \"\")
								{
									js_form_action
									(
										\"'.$this->bz_segment['SITE_URL'].'\", \"ajx_live_area_\", \"combo_put\", $(this).val() + \"/47/77\"
										, \"#frm_modal\", \"#process_modaldialog\", \"#error_message_modaldialog\"
									);
								}
							}
						);

						$(\"#txt77\").change(function()
							{
								$(\"#txt78, #txt79\").empty()
									.append( $(\"<option></option>\").val(\"\").html(\"'.$this->lang->line('hris_choose').'\") );

								if ($(this).val() != \"\")
								{
									js_form_action
									(
										\"'.$this->bz_segment['SITE_URL'].'\", \"ajx_live_area_\", \"combo_put\", $(this).val() + \"/48/78\"
										, \"#frm_modal\", \"#process_modaldialog\", \"#error_message_modaldialog\"
									);
								}
							}
						);

						$(\"#txt78\").change(function()
							{
								$(\"#txt79\").empty()
									.append( $(\"<option></option>\").val(\"\").html(\"'.$this->lang->line('hris_choose').'\") );

								if ($(this).val() != \"\")
								{
									js_form_action
									(
										\"'.$this->bz_segment['SITE_URL'].'\", \"ajx_live_area_\", \"combo_put\", $(this).val() + \"/49/79\"
										, \"#frm_modal\", \"#process_modaldialog\", \"#error_message_modaldialog\"
									);
								}
							}
						);
					';
				break;

			case '_form_information_email':
				$this->tbl_attr = array
					(
						'TABLE_MODAL' => array
							(
								'NAME' => 'hris_employee_emails'
								, 'NAME_ALIAS' => 'hris_employee_emails b'
								, 'PRIMARY' => array
									(
										'SHOW' => FALSE
										, 'DATA' => array('id', 'data__id')
									)
							)
						, 'VIEW_DETAIL' => array
							(
								'HEADING' => array
									(
										$this->lang->line('hris_email')
										, $this->lang->line('hris_status')
										, $this->access_rights['DELETE'] ? '&nbsp;' : NULL
									)
								, 'FIELDS' => 'id, data__id, email, status'
								, 'FIELDS_EDIT' => 'email'
								, 'FIELDS_ORDER' => 'status'
							)
						, 'FORM_MODAL' => array
							(
								'HEADING' => $this->lang->line('hris_modal')
								, 'FIELDS' => '*'
								, 'FIELDS_ORDER' => ''
								, 'COLUMN' => 2
							)
					);
				break;

			case '_form_information_phone':
				$this->tbl_attr = array
					(
						'TABLE_MODAL' => array
							(
								'NAME' => 'hris_employee_phone'
								, 'NAME_ALIAS' => 'hris_employee_phone b'
								, 'PRIMARY' => array
									(
										'SHOW' => FALSE
										, 'DATA' => array('id', 'data__id')
									)
							)
						, 'VIEW_DETAIL' => array
							(
								'HEADING' => array
									(
										$this->lang->line('hris_type')
										, $this->lang->line('hris_phone')
										, $this->lang->line('hris_status')
										, $this->access_rights['DELETE'] ? '&nbsp;' : NULL
									)
								, 'FIELDS' => 'id, data__id, type, number, status'
								, 'FIELDS_EDIT' => 'number'
								, 'FIELDS_ORDER' => 'status, type'
							)
						, 'FORM_MODAL' => array
							(
								'HEADING' => $this->lang->line('hris_modal')
								, 'FIELDS' => '*'
								, 'FIELDS_ORDER' => ''
								, 'COLUMN' => 2
							)
					);
				break;

			case '_form_information_family_dependant':
				$this->tbl_attr = array
					(
						'TABLE_MODAL' => array
							(
								'NAME' => 'hris_employee_family'
								, 'NAME_ALIAS' => 'hris_employee_family b'
								, 'PRIMARY' => array
									(
										'SHOW' => FALSE
										, 'DATA' => array('id', 'data__id')
									)
							)
						, 'VIEW_DETAIL' => array
							(
								'HEADING' => array
									(
										$this->lang->line('hris_name')
										, $this->lang->line('hris_family_relationship')
										, $this->lang->line('hris_gender')
										, $this->lang->line('hris_employee_birth_place')
										, $this->lang->line('hris_employee_birth_date')
										, $this->lang->line('hris_occupation')
										, $this->lang->line('hris_marital_status')
										, $this->lang->line('hris_phone')
										, $this->lang->line('hris_status')
										, $this->access_rights['DELETE'] ? '&nbsp;' : NULL
									)
								, 'FIELDS' => 'id, data__id, name'
										. ', `fn_hris_master_data_get_name`("4", relationship__id, "'.$this->session->userdata('session_user_language_id').'") as relationship_name'
										. ', `fn_hris_master_data_get_name`("38", gender__id, "'.$this->session->userdata('session_user_language_id').'") as gender_name'
										. ', `fn_hris_master_area_get_name`(birth_place_city__id) as birth_place, birth_date'
										. ', `fn_hris_master_data_get_name`("5", occupation__id, "'.$this->session->userdata('session_user_language_id').'") as occupation_name'
										. ', `fn_hris_master_data_get_name`("2", marital_status__id, "'.$this->session->userdata('session_user_language_id').'") as marital_status_name'
										. ', phone'
										. ', (case status when "Alive" then "'.$this->lang->line('hris_alive').'" else "'.$this->lang->line('hris_deceased').'" end) as status'
								, 'FIELDS_EDIT' => 'name'
								, 'FIELDS_ORDER' => 'id'
							)
						, 'FORM_MODAL' => array
							(
								'HEADING' => $this->lang->line('hris_modal')
								, 'FIELDS' => 'id, data__id, name, relationship__id, gender__id'
										. ', concat("ajax_call::", "'.$this->bz_segment['SITE_URL'].'", "::ajx_live_area_::combo_put::NULL/47/75/::", ifnull(birth_place_city__id, "")) as birth_place'
										. ', birth_date, occupation__id, group_of_employee_status, company_name, marital_status__id, education__id, dependent_status, phone, address, status'
								, 'FIELDS_ORDER' => ''
								, 'COLUMN' => 4
								, 'COLUMN_JOIN' => 2
							)
					);

				$this->form['JAVASCRIPT']['MODAL'] =
					'
						if ($(\"#txt70\").val() == \"\")
						{
							js_form_action
							(
								\"'.$this->bz_segment['SITE_URL'].'\", \"ajx_live_area_\", \"combo_put\", \"NULL/47/75\"
								, \"#frm_modal\", \"#process_modaldialog\", \"#error_message_modaldialog\"
							);
						}

						js_datetime_picker_show(\"txt76\", \"txt77\", \"%Y-%m-%d\");
					';
				break;

			case '_form_information_education':
				$this->tbl_attr = array
					(
						'TABLE_MODAL' => array
							(
								'NAME' => 'hris_employee_education'
								, 'NAME_ALIAS' => 'hris_employee_education b'
								, 'PRIMARY' => array
									(
										'SHOW' => FALSE
										, 'DATA' => array('id', 'data__id')
									)
							)
						, 'VIEW_DETAIL' => array
							(
								'HEADING' => array
									(
										$this->lang->line('hris_education')
										, $this->lang->line('hris_start')
										, $this->lang->line('hris_end')
										, $this->lang->line('hris_instantion_institution')
										, $this->lang->line('hris_employee_education_gpa_get')
										, $this->lang->line('hris_employee_education_certificate')
										, $this->lang->line('hris_employee_education_certificate').' '.$this->lang->line('hris_number')
										, $this->lang->line('hris_default')
										, $this->access_rights['DELETE'] ? '&nbsp;' : NULL
									)
								, 'FIELDS' => 'id, data__id'
									. ', `fn_hris_master_data_get_name`("8", education__id, "'.$this->session->userdata('session_user_language_id').'") as education_name'
									. ', year_start, year_end'
									. ', instantion_education__id'
									. ', gpa_get, certificate_status, certificate_number, `default`'
								, 'FIELDS_EDIT' => 'education_name'
								, 'FIELDS_ORDER' => 'year_start'
							)
						, 'FORM_MODAL' => array
							(
								'HEADING' => $this->lang->line('hris_modal')
								, 'FIELDS' => 'id, data__id'
									. ', education__id'
									. ', year_start, year_end, instantion_education__id, faculty__id, mayor__id, country__id'
									. ', concat("ajax_call::", "'.$this->bz_segment['SITE_URL'].'", "::ajx_live_area_::combo_put::", country__id, "/46/79/::", province__id) as province_id'
									. ', concat("ajax_call::", "'.$this->bz_segment['SITE_URL'].'", "::ajx_live_area_::combo_put::", province__id, "/47/80/::", city__id) as city_id'
									. ', gpa_get, gpa_max'
									. ', (case certificate_status when "Active" then "'.$this->lang->line('hris_current').'" else "'.$this->lang->line('hris_not_available').'" end) as certificate_status'
									. ', certificate_number, certificate_date'
									. ', (case `default` when "Active" then "'.$this->lang->line('hris_current').'" else "'.$this->lang->line('hris_not_available').'" end) as `default`'
								, 'FIELDS_ORDER' => ''
								, 'COLUMN' => 4
								, 'COLUMN_JOIN' => 2
							)
					);

				$this->form['JAVASCRIPT']['MODAL'] =
					'
						$(\"#txt78\").change(function()
							{
								$(\"#txt79, #txt80\").empty()
									.append( $(\"<option></option>\").val(\"\").html(\"'.$this->lang->line('hris_choose').'\") );

								if ($(this).val() != \"\")
								{
									js_form_action
									(
										\"'.$this->bz_segment['SITE_URL'].'\", \"ajx_live_area_\", \"combo_put\", $(this).val() + \"/46/79\"
										, \"#frm_modal\", \"#process_modaldialog\", \"#error_message_modaldialog\"
									);
								}
							}
						);

						$(\"#txt79\").change(function()
							{
								$(\"#txt80\").empty()
									.append( $(\"<option></option>\").val(\"\").html(\"'.$this->lang->line('hris_choose').'\") );

								if ($(this).val() != \"\")
								{
									js_form_action
									(
										\"'.$this->bz_segment['SITE_URL'].'\", \"ajx_live_area_\", \"combo_put\", $(this).val() + \"/47/80\"
										, \"#frm_modal\", \"#process_modaldialog\", \"#error_message_modaldialog\"
									);
								}
							}
						);

						js_datetime_picker_show(\"txt85\", \"txt86\", \"%Y-%m-%d\");
					';
				break;


			/**
			 * @section employee employment
			 */
			case '_form_employment_general_leave':
				$this->tbl_attr = array
					(
						'TABLE_MODAL' => array
							(
								'NAME' => 'hris_employee_leave_management'
								, 'NAME_ALIAS' => 'hris_employee_leave_management b'
								, 'PRIMARY' => array
									(
										'SHOW' => FALSE
										, 'DATA' => array('leave_management__id', 'data__id')
									)
							)
						, 'VIEW_DETAIL' => array
							(
								'HEADING' => array
									(
										$this->lang->line('hris_type')
										, $this->lang->line('hris_name')
										, $this->lang->line('hris_valid').' '.$this->lang->line('hris_date').' '.$this->lang->line('hris_start')
										, $this->lang->line('hris_valid').' '.$this->lang->line('hris_date').' '.$this->lang->line('hris_end')
										, $this->lang->line('hris_valid').' '.$this->lang->line('hris_date').' '.$this->lang->line('hris_next')
										, $this->lang->line('hris_total')
										, $this->lang->line('hris_used')
										, $this->lang->line('hris_remaining')
										, $this->lang->line('hris_active')
										, $this->access_rights['DELETE'] ? '&nbsp;' : NULL
									)
								, 'FIELDS' => 'data__id, leave_management__id'
										. ', (select `fn_hris_master_data_get_name`("37", leave_type__id, "'.$this->session->userdata('session_user_language_id').'") from bz_hris_attendance_leave_management c where b.leave_management__id = c.id) as leave_type_name'
										. ', (select name from bz_hris_attendance_leave_management c where b.leave_management__id = c.id) as leave_name'
										. ', valid_date_start, valid_date_end, valid_date_next, total, used, (total - used) as remaining, activated'
								, 'FIELDS_EDIT' => ''
								, 'FIELDS_ORDER' => 'leave_type_name'
							)
						, 'FORM_MODAL' => array
							(
								'HEADING' => $this->lang->line('hris_modal')
								, 'FIELDS' => '*'
								, 'FIELDS_ORDER' => ''
								, 'COLUMN' => 2
							)
					);

				$this->form['JAVASCRIPT']['MODAL'] =
					'
						select_toggle = true;
						$(\".link_select_toggle\").click
							(function()
							{
								$(\"#txt72 option\").prop(\"selected\", select_toggle);
								select_toggle = ! select_toggle;
								return false;
							});

						js_form_action
						(
							\"'.$this->bz_segment['SITE_URL'].'\", \"ajx_modal_data_\", \"put\", \"x/\" + $(\"#txt71\").val()
							, \"#frm_modal\", \"#process_modaldialog\", \"#error_message_modaldialog\"
						);
					';
				break;


			/**
			 * @section employee additional
			 */
			case '_form_additional_job_experience':
				$this->tbl_attr = array
					(
						'TABLE_MODAL' => array
							(
								'NAME' => 'hris_employee_job_experience'
								, 'NAME_ALIAS' => 'hris_employee_job_experience b'
								, 'PRIMARY' => array
									(
										'SHOW' => FALSE
										, 'DATA' => array('id', 'data__id')
									)
							)
						, 'VIEW_DETAIL' => array
							(
								'HEADING' => array
									(
										$this->lang->line('hris_company_name')
										, $this->lang->line('hris_address')
										, $this->lang->line('hris_start')
										, $this->lang->line('hris_end')
										, $this->lang->line('hris_employee_job_experience_salary')
										, $this->access_rights['DELETE'] ? '&nbsp;' : NULL
									)
								, 'FIELDS' => 'id, data__id, company_name, company_address, date_start, date_end, end_salary'
								, 'FIELDS_EDIT' => 'company_name'
								, 'FIELDS_ORDER' => 'date_start desc'
							)
						, 'FORM_MODAL' => array
							(
								'HEADING' => $this->lang->line('hris_modal')
								, 'FIELDS' => '*'
								, 'FIELDS_ORDER' => ''
								, 'COLUMN' => 4
								, 'COLUMN_JOIN' => 2
							)
					);

				$this->form['JAVASCRIPT']['MODAL'] =
					'
						js_datetime_picker_show(\"txt72\", \"txt73\", \"%Y-%m-%d\");
						js_datetime_picker_show(\"txt73\", \"txt74\", \"%Y-%m-%d\");
					';
				break;
		}

		switch ($this->form['MODEL'])
		{
			case 'STANDARD':
				$this->web_data['PAGE']['ICON_BAR'] = array
					(
						'USE' => 'TRUE'
						, 'SAVE' => TRUE
						, 'ADD_DETAIL' => FALSE
					);
				break;

			case 'MODALDIALOG':
				$this->web_data['PAGE']['ICON_BAR'] = array
					(
						'USE' => 'TRUE'
						, 'SAVE' => FALSE
						, 'ADD_DETAIL' => TRUE
					);

				$this->tbl_attr['TABLE'] = array
					(
						'NAME' => 'hris_employee_data'
						, 'NAME_ALIAS' => 'hris_employee_data a'
						, 'PRIMARY' => array
							(
								'SHOW' => FALSE
								, 'DATA' => array('id')
							)
					);
				$this->tbl_attr['FORM'] = array
					(
						'FIELDS' => 'id'
						, 'FIELDS_ORDER' => ''
						, 'COLUMN' => 2
					);

				$this->tbl_viewdetail_attr = array
					(
						'NAME' => $this->tbl_attr['TABLE_MODAL']['NAME_ALIAS']
						, 'PRIMARY' => $this->tbl_attr['TABLE_MODAL']['PRIMARY']
						, 'HEADING' => $this->tbl_attr['VIEW_DETAIL']['HEADING']
						, 'FIELDS' => array
							(
								'NAME' => $this->tbl_attr['VIEW_DETAIL']['FIELDS']
								, 'CAPTION' => $this->tbl_attr['VIEW_DETAIL']['FIELDS_EDIT']
								, 'ORDER' => $this->tbl_attr['VIEW_DETAIL']['FIELDS_ORDER']
							)
						, 'JAVASCRIPT' => array
							(
								'VIEWLIST_GENERATE' => array
									(
										'JS_FUNCTION_NAME' => 'js_modaldialog_data_put'
										, 'JS_FUNCTION_PARAMETERS' => '"'.$this->bz_segment['SITE_URL'].'/'.$this->form['NAME_MODAL'].'", "frm_modal", "txt0", "txt72", "js_modal_functions", "'.$this->bz_segment['SITE_URL'].'", "ajx_modal_data_", "put"'
									)
							)
					);
				break;
		}

		$this->tbl_attr['URL'] = array
			(
				'FORM' => $this->bz_segment['SITE_URL'].'/form'
				, 'VIEW' => $this->bz_segment['SITE_URL'].'/view'
			);

		/**
		 * @description if the type is personal then FORCE all the access_rights to FALSE
		 */
		switch ($this->form['TYPE'])
		{
			case 'personal':
				$this->access_rights = array
					(
						'ADD' => FALSE
						, 'EDIT' => FALSE
						, 'DELETE' => FALSE
					);

				$this->form['BAR'] = array('EMPLOYEE_LIST' => FALSE, 'MENU_PARENT_ID' => 101000001);

				$this->web_data['PAGE']['ICON_BAR']['USE'] = 'FALSE';
				break;

			case 'list':
				$this->form['BAR'] = array('EMPLOYEE_LIST' => TRUE, 'MENU_PARENT_ID' => 101000029);
				break;
		}

		/**
		 * @description template lite variables
		 */
		$this->bz_tlite_var['CACHE_PATH'] = $this->bz_tlite_var['SESSION']['USER_ID'].'|'.str_replace('/', '|', $this->bz_segment['URL']);
		$this->bz_tlite_var['CACHE'] = array
			(
				'PUBLIC' => $this->bz_tlite_var['SESSION']['USER_ID']
				, 'PRIVATE' => array
					(
						'GLOBAL' => $this->bz_tlite_var['CACHE_PATH']
						, 'VIEW' => $this->bz_tlite_var['CACHE_PATH'].'|view'
						, 'FORM' => $this->bz_tlite_var['CACHE_PATH'].'|form'
					)
			);
	}


	/**
	 * @function _remap
	 * @description remap the module
	 */
	public function _remap($method, $parameters = array())
	{
		if (count($parameters) > 0)
		{
			$method = $parameters[0];
			$method_temp = array_shift($parameters);

			call_user_func_array(array($this, $method), $parameters);
		}
		else
		{
			switch ($method)
			{
				case 'list_employee':
					$this->view();
					break;

				default:
					$this->form();
					break;
			}
		}
	}


	/**
	 * @function index()
	 * @description main controller
	 */
	public function index()
	{
		/**
		 * @description choose which controller to show
		 */
		redirect('admin/desktop');
	}


	/**
	 * @function view()
	 * @description view table list of data
	 */
	public function view($prm_page = '', $prm_search_term = '')
	{
		if ($this->web_data['BISKITZ']['HEADER']['BROWSER_SUPPORTED'] == '')
		{
			/**
			 * @description view can only be accessed from list_employee!
			 */
			if ($this->bz_segment['MASTER_DATA'] == 'list_employee')
			{
				/**
				 * @description load the models
				 */
				$this->load->model('M_viewlist');
				$this->load->library('encrypt');


				/**
				 * @description process the searching
				 */
				if (trim($this->input->post('txt_search')) != '')
				{
					$search_string = $this->encrypt->encode($this->input->post('txt_search'));
					redirect($this->bz_segment['SITE_URL'].'/view/0/'.$search_string);
				}
				if (trim($prm_search_term) != '')
				{
					$prm_search_term = strtolower($this->encrypt->decode($prm_search_term));
					$search_term = array
						(
							'lower(number)' => $prm_search_term
							, 'lower(name_official)' => $prm_search_term
							, 'lower(birth_date)' => $prm_search_term
						);
				}
				else
				{
					$search_term = '';
				}


				/**
				 * @description if there isn't any css/ajax cache, build it! else show cache!
				 */
				if ( ! $this->bz_tlite->is_cached($this->bz_tlite_var['NAMES']['CSS'], $this->bz_tlite_var['CACHE']['PRIVATE']['VIEW']))
				{
					/**
					 * @section begin page init
					 */
						/**
						 * @description show the menu
						 */
						$menu = $this->M_menu->shows();
						$this->web_data['JAVASCRIPT_MENU'] = $menu['JAVASCRIPT_MENU'];
						$this->web_data['PAGE']['MENU'] = $menu['PAGE']['MENU'];

						/**
						 * @description init the css and the ajax needed
						 */
						$css_files = array
							(
								array('layout' => 'screen')
								, array('tipsy/tipsy' => 'screen')
								, array('form_icon_bar' => 'screen')
								, array('nanoscroller/nanoscroller' => ($menu['PAGE']['MENU']['FAVORITE']['LIST'] != 'Error') ? 'screen' : NULL)
								, array('shortcut_bar' => ($menu['PAGE']['MENU']['FAVORITE']['LIST'] != 'Error') ? 'screen' : NULL)
								, array('ddm/multi-ddm' => 'screen')
							);
						$js_files = array
							(
								'js/plugins/ddm' => array('jquery.multi-ddm.pack')
								, 'js/plugins/nanoscroller' => ($menu['PAGE']['MENU']['FAVORITE']['LIST'] != 'Error') ? array('jquery.nanoscroller.min', 'overthrow.min') : NULL
								, 'js/plugins/tipsy' => array('jquery.tipsy.pack')
								, $this->web_data['BISKITZ']['SETTINGS']['BISKITZ_JS_FUNCTIONS_PATH'] => array('common', 'form', 'error')
								, 'themes/'.$this->web_data['BISKITZ']['SETTINGS']['BISKITZ_THEME_ADMIN'].'/'.$this->web_data['BISKITZ']['SETTINGS']['BISKITZ_JS_PATH'] => array('common')
							);
					/**
					 * @section end page init
					 */


					/**
					 * @section begin generate template variables
					 */
						/**
						 * @description css and ajax
						 */
						$this->web_data['PAGE']['CSS_FILES'] = $this->M_template->css_generate($css_files, $this->web_data['BISKITZ']['SETTINGS']['BISKITZ_THEME_ADMIN']);
						$this->web_data['PAGE']['JAVASCRIPT_FILES'] = $this->M_template->js_generate($js_files);

						/**
						 * @description initialize the additional javascript
						 */
						if ($menu['PAGE']['MENU']['FAVORITE']['LIST'] != 'Error')
						{
							$this->web_data['JAVASCRIPT'] .= '
								<script>
									$(function()
									{
										$(".nano").nanoScroller({preventPageScrolling: true});
									});
								</script>
								';
						}

						/**
						 * @description menu descriptions
						 */
						$this->web_data['PAGE']['DETAIL'] = $this->M_menu->detail();
					/**
					 * @section end generate template variables
					 */
				}


				/**
				 * @section begin table view init
				 */
					/**
					 * @description init the pagination
					 */
					$paging_init = array
						(
							'base_url' => $this->tbl_attr['URL']['VIEW']
							, 'total_rows' => $this->M_database->total_rows
								(
									'db_default'
									, $this->tbl_attr['TABLE']['NAME']
									, $this->tbl_attr['VIEW']['TABLE']['WHERE']
									, FALSE
									, $search_term
								)
							, 'per_page' => $this->tbl_attr['VIEW']['TOT_ROW']
							, 'uri_segment' => $this->bz_segment['END'] + 2
						);
					$this->load->library('pagination');
					$this->pagination->initialize($paging_init);
					$paging_link = $this->pagination->my_paging_links(TRUE, $this->bz_segment['END'] + 3);

					/**
					 * @description init the command button
					 */
					$this->load->model('admin/M_command_bar');
					$view_list_commands = $this->M_command_bar->view($prm_search_term, $paging_link);

					/**
					 * @description init the table list
					 */
					$view_list_content = $this->M_viewlist->generate
						(
							'db_default'
							, $this->tbl_attr['VIEW']['FIELDS'], $this->tbl_attr['TABLE']['PRIMARY'], $this->tbl_attr['VIEW']['FIELDS_EDIT'], $this->tbl_attr['VIEW']['FIELDS_ORDER']
							, $this->tbl_attr['TABLE']['NAME'], $this->tbl_attr['VIEW']['TABLE']['WHERE']
							, $search_term
							, 'admin/hris/employee/profile/list_information_summary'
							, $this->tbl_attr['VIEW']['TOT_ROW']
							, 'form/7'
							, TRUE
							, FALSE
						);

					if (is_array($view_list_content))
					{
						$this->table->set_heading($this->tbl_attr['VIEW']['HEADING']);
						$view_list_content = $this->table->generate($view_list_content);
					}
					else
					{
						$view_list_content = '<center class="error_field">'.$this->lang->line('data_view_error').'</center>';
					}
				/**
				 * @section end table view init
				 */


				/**
				 * @section begin generate template variables
				 */

					/**
					 * @description view list
					 */
					$this->web_data['PAGE']['VIEW'] = array
						(
							'FORM' => array
								(
									'OPEN' => form_open($this->tbl_attr['URL']['VIEW'], array('id' => 'frm_header', 'onSubmit' => 'return false'), '')
								)
							, 'COMMANDS' => $view_list_commands
							, 'LISTS' => $view_list_content
						);
				/**
				 * @section end generate template variables
				 */


				/**
				 * @description log the action!
				 */
				$this->M_log->write
					(
						'db_default'
						, trim($prm_page) != ''
							? sprintf
								(
									trim($prm_search_term) != '' ? $this->lang->line('log_view_search') : $this->lang->line('log_view_page')
									, $this->router->class
									, $this->pagination->cur_page
									, $prm_search_term
								)
							: sprintf($this->lang->line('log_view_access'), $this->router->class)
					);
			}
			else
			{
				/**
				 * @description sorry folks, only list_employee that can access the view
				 */
				redirect('admin/desktop');
			}



		}
		else
		{
			/**
			 * @section Browser NOT Supported
			 */
				/**
				 * @description browser not supported message error
				 */
				$css_files = array(array('layout' => 'screen'));


				/**
				 * @section begin generate template variables
				 */
					/**
					 * @description css and ajax
					 */
					$this->web_data['PAGE']['CSS_FILES'] = $this->M_template->css_generate($css_files, $this->web_data['BISKITZ']['SETTINGS']['BISKITZ_THEME_ADMIN']);
				/**
				 * @section end generate template variables
				 */

		}



		/**
		 * @description output template variables
		 */
		$this->bz_tlite->assign('WEB_DATA', $this->web_data);


		/**
		 * @section begin output
		 */
		$this->bz_tlite->display($this->bz_tlite_var['NAMES']['HEADER'], $this->bz_tlite_var['CACHE']['PUBLIC']);
		$this->bz_tlite->display($this->bz_tlite_var['NAMES']['CSS'], $this->bz_tlite_var['CACHE']['PRIVATE']['VIEW']);
		$this->bz_tlite->display($this->bz_tlite_var['NAMES']['MENU'], $this->bz_tlite_var['CACHE']['PUBLIC']);
		$this->bz_tlite->display($this->bz_tlite_var['NAMES']['CONTENT_DESCRIPTION'], $this->bz_tlite_var['CACHE']['PRIVATE']['GLOBAL']);

		$this->bz_tlite->cache = FALSE;
		$this->bz_tlite->display($this->bz_tlite_var['NAMES']['CONTENT_FORM_COMMAND_BAR']);
		$this->bz_tlite->display($this->bz_tlite_var['NAMES']['CONTENT_FORM']);

		$this->bz_tlite->cache = TRUE;
		$this->bz_tlite->display($this->bz_tlite_var['NAMES']['CONTENT_SHORTCUT_BAR'], $this->bz_tlite_var['CACHE']['PUBLIC']);
		$this->bz_tlite->display($this->bz_tlite_var['NAMES']['FOOTER'], $this->bz_tlite_var['CACHE']['PUBLIC']);
		$this->bz_tlite->display($this->bz_tlite_var['NAMES']['JAVASCRIPT'], $this->bz_tlite_var['CACHE']['PRIVATE']['VIEW']);
		$this->bz_tlite->display($this->bz_tlite_var['NAMES']['FOOTER_END'], $this->bz_tlite_var['CACHE']['PUBLIC']);
		/**
		 * @section end output
		 */
	}


	/**
	 * @function form()
	 * @description form for data entry
	 */
	public function form($prm_bar_view = '7', $prm_employee_id = '')
	{
		if ($this->web_data['BISKITZ']['HEADER']['BROWSER_SUPPORTED'] == '')
		{
			/**
			 * @description show the form if the (form type is 'list' and prm_employee_id not '') OR (form type is 'personal' and prm_employee_id is '')
			 */
			if (($this->form['TYPE'] == 'list' && trim($prm_employee_id) != '') OR ($this->form['TYPE'] == 'personal' && trim($prm_employee_id) == ''))
			{
				if ($this->form['TYPE'] == 'personal')
				{
					$prm_employee_id = $this->session->userdata('session_user_id');
				}


				/**
				 * @description if there isn't any css/ajax cache, build it! else show cache!
				 */
				if ( ! $this->bz_tlite->is_cached($this->bz_tlite_var['NAMES']['CSS'], $this->bz_tlite_var['CACHE']['PRIVATE']['FORM']))
				{
					/**
					 * @section begin page init
					 */
						/**
						 * @description show the menu
						 */
						$menu = $this->M_menu->shows();
						$this->web_data['JAVASCRIPT_MENU'] = $menu['JAVASCRIPT_MENU'];
						$this->web_data['PAGE']['MENU'] = $menu['PAGE']['MENU'];

						/**
						 * @description init the css and the ajax needed
						 */
						$css_files = array
							(
								array('layout' => 'screen')
								, array('tipsy/tipsy' => 'screen')
								, array('validate/validate' => 'screen')
								, array('form_icon_bar' => 'screen')
								, array('nanoscroller/nanoscroller' => ($menu['PAGE']['MENU']['FAVORITE']['LIST'] != 'Error') ? 'screen' : NULL)
								, array('shortcut_bar' => ($menu['PAGE']['MENU']['FAVORITE']['LIST'] != 'Error') ? 'screen' : NULL)
								, array('jqModal/jqModal' => 'screen')
								, array('dynDateTime/dynDateTime' => 'screen')
								, array('ddm/multi-ddm' => 'screen')
							);
						$js_files = array
							(
								'js/plugins/ddm' => array('jquery.multi-ddm.pack')
								, 'js/plugins/nanoscroller' => ($menu['PAGE']['MENU']['FAVORITE']['LIST'] != 'Error') ? array('jquery.nanoscroller.min', 'overthrow.min') : NULL
								, 'js/plugins/validate' => array('jquery.validate.pack', 'jquery.metadata')
								, 'js/plugins/tipsy' => array('jquery.tipsy.pack')
								, 'js/plugins/jqModal' => array('jqModal.pack')
								, 'js/plugins/dynDateTime' => array('jquery.dynDateTime.pack')
								, 'js/plugins/dynDateTime/lang/pack' => array('calendar-'.$this->session->userdata('session_user_language_abbr'))
								, 'js/plugins/fileupload' => array('ajaxfileupload')
								, $this->web_data['BISKITZ']['SETTINGS']['BISKITZ_JS_FUNCTIONS_PATH'] => array('common', 'form', 'error', 'modaldialog', 'datetime_picker')
								, 'themes/'.$this->web_data['BISKITZ']['SETTINGS']['BISKITZ_THEME_ADMIN'].'/'.$this->web_data['BISKITZ']['SETTINGS']['BISKITZ_JS_PATH'] => array('common')
							);


						/**
						 * @section begin form initialize
						 */
							/**
							 * @description load the models
							 */
							$this->load->model(array('admin/hris/HRIS_M_live_data', 'admin/hris/HRIS_M_command_bar'));


							/**
							 * @description initialize the form elements based on the selected view
							 */
							$form_bar = $this->HRIS_M_command_bar->employee_bar($this->form['BAR']['EMPLOYEE_LIST'], $this->form['BAR']['MENU_PARENT_ID'], $prm_bar_view);
							switch ($this->form['MODEL'])
							{
								case 'STANDARD':
									$this->form['HEADER_FUNCTION'] = $this->form['NAME'];
									break;

								case 'MODALDIALOG':
									$this->form['HEADER_FUNCTION'] = '_form_modal';
									break;
							}
							$form_content = $this->{$this->form['HEADER_FUNCTION']}();

							$form_content = $form_bar . $form_content;
						/**
						 * @section end form initialize
						 */
					/**
					 * @section end page init
					 */



					/**
					 * @section begin generate template variables
					 */
						/**
						 * @description css and ajax
						 */
						$this->web_data['PAGE']['CSS_FILES'] = $this->M_template->css_generate($css_files, $this->web_data['BISKITZ']['SETTINGS']['BISKITZ_THEME_ADMIN']);
						$this->web_data['PAGE']['JAVASCRIPT_FILES'] = $this->M_template->js_generate($js_files);

						/**
						 * @description initialize the additional javascript
						 */
						$this->web_data['JAVASCRIPT'] .= '
							<script>
								var js_modal_functions =
								"
									$(\"#btn_modal_save\").click
										(function()
										{
											js_form_action_validate
											(
												\"'.$this->bz_segment['SITE_URL'].'\", \"ajx_modal_\", \"insert\", \"\"
												, \"#frm_modal\", \"#process_modaldialog\", \"#error_message_modaldialog\"
												, \"validate\"
											);

											$(\"#txt72\").focus().select();
										});
								'.$this->form['JAVASCRIPT']['MODAL'].'
								";


								$(function()
								{
									$("#btn_add_detail").click
										(function()
										{
											js_modaldialog_show
											(
												"'.$this->bz_segment['SITE_URL'].'/'.$this->form['NAME_MODAL'].'/" + $("#txt0").val()
												, "frm_modal"
												, "txt0", "txt72"
												, js_modal_functions
											);
										});

									$("#btn_save").click
										(function()
										{
											js_form_action_validate
											(
												"'.$this->bz_segment['SITE_URL'].'", "ajx_", "update", ""
												, "#frm_header", "#process", "#error_message"
												, "validate"
											);
										});

									$("#btn_employee_detail").click
										(function()
										{
											js_form_action
											(
												"'.$this->bz_segment['SITE_URL'].'", "ajx_employee_", "action", ""
												, "#frm_header", "#process", "#error_message"
											);
										});

									js_form_action
									(
										"'.$this->bz_segment['SITE_URL'].'", "ajx_live_employee_", "combo_put", "0/" + "'.$prm_employee_id.'"
										, "#frm_header", "#process", "#error_message"
									);

									'.$this->form['JAVASCRIPT']['HEADER'].'
									$("#txt0").focus().select();
						';

						if ($menu['PAGE']['MENU']['FAVORITE']['LIST'] != 'Error')
						{
							$this->web_data['JAVASCRIPT'] .= '$(".nano").nanoScroller({preventPageScrolling: true});';
						}

						$this->web_data['JAVASCRIPT'] .= '
								});
							</script>
						';

						/**
						 * @description menu descriptions
						 */
						$this->web_data['PAGE']['DETAIL'] = $this->M_menu->detail();

						/**
						 * @description icon bar
						 */
						$this->load->model('admin/M_command_bar');
						$this->web_data['PAGE']['ICON_BAR'] = $this->M_command_bar->form($this->web_data['PAGE']['ICON_BAR']['USE'], FALSE, $this->web_data['PAGE']['ICON_BAR']['SAVE'], $this->web_data['PAGE']['ICON_BAR']['ADD_DETAIL'], FALSE, FALSE);

						/**
						 * @description form dialogs
						 */
						$this->web_data['PAGE']['FORM'] = array
							(
								'OPEN' => form_open('', array('id' => 'frm_header', 'onSubmit' => 'return false'), '')
								, 'CONTENT' => $form_content
								, 'CENTER' => 'FALSE'
							);

						/**
						 * @description notes
						 */
						$this->web_data['PAGE']['NOTES'] = array
							(
								'USE' => 'TRUE'
								, 'MESSAGE' => array
									(
										'SHORTCUTS' => $this->lang->line('notes_shortcuts')
										, 'ADDITIONAL' => $this->lang->line('notes_additional')
									)
							);
					/**
					 * @section end generate template variables
					 */
				}


				/**
				 * @description get the data for editing via ajax
				 */
				$this->web_data['JAVASCRIPT_EXTEND'] = '
					<script>
						$(function()
						{
							js_form_action
							(
								"'.$this->bz_segment['SITE_URL'].'", "ajx_data_", "put", "'.$prm_employee_id.'"
								, "#frm_header", "#process", "#error_message"
							);
						});
					</script>
				';


				/**
				 * @description log the action!
				 */
				$this->M_log->write('db_default', sprintf($this->lang->line('log_form_access'), $this->router->class, 'form'));
			}
			else
			{
				/**
				 * @description doesn't have ADD or EDIT access? redirect to desktop
				 */
				redirect('admin/desktop');
			}



		}
		else
		{
			/**
			 * @section Browser NOT Supported
			 */
				/**
				 * @description browser not supported message error
				 */
				$css_files = array(array('layout' => 'screen'));


				/**
				 * @section begin generate template variables
				 */
					/**
					 * @description css and ajax
					 */
					$this->web_data['PAGE']['CSS_FILES'] = $this->M_template->css_generate($css_files, $this->web_data['BISKITZ']['SETTINGS']['BISKITZ_THEME_ADMIN']);
				/**
				 * @section end generate template variables
				 */
		}



		/**
		 * @description output template variables
		 */
		$this->bz_tlite->assign('WEB_DATA', $this->web_data);


		/**
		 * @section begin output
		 */
		$this->bz_tlite->display($this->bz_tlite_var['NAMES']['HEADER'], $this->bz_tlite_var['CACHE']['PUBLIC']);
		$this->bz_tlite->display($this->bz_tlite_var['NAMES']['CSS'], $this->bz_tlite_var['CACHE']['PRIVATE']['FORM']);
		$this->bz_tlite->display($this->bz_tlite_var['NAMES']['MENU'], $this->bz_tlite_var['CACHE']['PUBLIC']);
		$this->bz_tlite->display($this->bz_tlite_var['NAMES']['CONTENT_DESCRIPTION'], $this->bz_tlite_var['CACHE']['PRIVATE']['GLOBAL']);
		$this->bz_tlite->display($this->bz_tlite_var['NAMES']['CONTENT_FORM_ICON_BAR'], $this->bz_tlite_var['CACHE']['PRIVATE']['FORM']);
		$this->bz_tlite->display($this->bz_tlite_var['NAMES']['CONTENT_FORM'], $this->bz_tlite_var['CACHE']['PRIVATE']['FORM']);
		$this->bz_tlite->display($this->bz_tlite_var['NAMES']['CONTENT_SHORTCUT_BAR'], $this->bz_tlite_var['CACHE']['PUBLIC']);
		$this->bz_tlite->display($this->bz_tlite_var['NAMES']['FOOTER'], $this->bz_tlite_var['CACHE']['PUBLIC']);
		$this->bz_tlite->display($this->bz_tlite_var['NAMES']['JAVASCRIPT'], $this->bz_tlite_var['CACHE']['PRIVATE']['FORM']);

		$this->bz_tlite->cache = FALSE;
		$this->bz_tlite->display($this->bz_tlite_var['NAMES']['JAVASCRIPT_EXTEND']);

		$this->bz_tlite->cache = TRUE;
		$this->bz_tlite->display($this->bz_tlite_var['NAMES']['FOOTER_END'], $this->bz_tlite_var['CACHE']['PUBLIC']);
		/**
		 * @section end output
		 */
	}



/**
 * @section AJAX Action Section
 */

	/**
	 * @function ajx_update()
	 * @description update the data
	 */
	public function ajx_update()
	{
		if ($this->input->is_ajax_request() && $this->access_rights['EDIT'])
		{
			/**
			 * @description load the models
			 */
			$this->load->model('admin/M_live_data');


			switch ($this->form['NAME'])
			{
				case '_form_information_summary':
				case '_form_information_data':
					$data = array
						(
							'id' => $this->input->post('txtinput[2]')
#							, 'number' => $this->input->post('txtinput[3]')
							, 'name_first' => $this->input->post('txtinput[4]')
							, 'name_middle' => $this->input->post('txtinput[5]')
							, 'name_last' => $this->input->post('txtinput[6]')
							, 'name_official' => $this->input->post('txtinput[7]')
							, 'name_nick' => $this->input->post('txtinput[8]')
							, 'salutation__id' => $this->input->post('txtinput[9]')
							, 'nationality__id' => $this->input->post('txtinput[10]')
							, 'birth_place_city__id' => $this->input->post('txtinput[11]')
							, 'birth_date' => $this->input->post('txtinput[12]')
							, 'gender__id' => $this->input->post('txtinput[13]')
							, 'religion__id' => $this->input->post('txtinput[14]')
							, 'marital_status__id' => $this->input->post('txtinput[15]')
							, 'marital_place' => $this->input->post('txtinput[16]')
							, 'marital_date' => $this->input->post('txtinput[17]')
							, 'id_card_number' => $this->input->post('txtinput[18]')
							, 'id_card_expire' => $this->input->post('txtinput[19]')
							, 'tax_id' => $this->input->post('txtinput[20]')
							, 'tax_type__id' => $this->input->post('txtinput[21]')
							, 'finger_id' => $this->input->post('txtinput[22]')
						);
					break;
			}

			$return_value = $this->M_live_data->update
				(
					'db_default'
					, $this->tbl_attr['TABLE']['NAME']
					, array('id' => $this->input->post('txtinput[2]'))
					, $data
					/**
					 * TODO: got to do something with the user upload file (eg: photo or documents)
					 */
#							, $logo_attachment_id != ''
#								? array_merge
#									(
#										array('logo_attachment__id' => $logo_attachment_id)
#										, $company_profile_data
#									)
#								: $data
					, 'form', 'js_action_success', ''
					, FALSE
				);


			$return_value = json_encode($return_value);
			echo $return_value;
		}
	}


	/**
	 * @function ajx_data_put()
	 * @description get the data from database and put them to the form via ajax!
	 */
	public function ajx_data_put($prm_employee_id = '')
	{
#		if ($this->input->is_ajax_request() && $this->form['TYPE'] == 'list' && $this->access_rights['EDIT'] && trim($prm_employee_id) != '')
		if ($this->input->is_ajax_request())
		{
			if ($this->form['TYPE'] == 'personal')
			{
				$prm_employee_id = $this->session->userdata('session_user_id');
			}


			/**
			 * @description load the models
			 */
			$this->load->model('admin/M_live_data');


			switch ($this->form['MODEL'])
			{
				case 'VIEW':
				case 'STANDARD':
					$return_value = $this->M_live_data->put
						(
							'db_default'
							, $this->tbl_attr['TABLE']['NAME']
							, array('id' => $prm_employee_id)
							, $this->tbl_attr['FORM']['FIELDS']
							, 2
						);
					break;

				case 'MODALDIALOG':
					/**
					 * @description load the helper
					 */
					$this->load->helper('viewlist');


					$return_value = $this->M_live_data->put
						(
							'db_default'
							, $this->tbl_attr['TABLE']['NAME']
							, array('id' => $prm_employee_id)
							, $this->tbl_attr['FORM']['FIELDS']
							, 0, 'log_form_edit', 'form'

							, 'js_action_data_detail'
							, array
								(
									'FUNCTION_NAME' => 'detail_generate'
									, 'FUNCTION_ATTR' => array
										(
											'db_default'
											, $this->tbl_viewdetail_attr
											, array('data__id' => $prm_employee_id)
											, $this->tbl_viewdetail_attr['JAVASCRIPT']['VIEWLIST_GENERATE']
										)
								)
						);
					break;
			}


			$return_value = json_encode($return_value);
			echo $return_value;
		}
	}


	/**
	 * @function ajx_employee_action
	 * @description go to the selected employee detail
	 */
	public function ajx_employee_action()
	{
		if ($this->input->is_ajax_request())
		{
			/**
			 * @description load the models
			 */
			$this->load->model('admin/hris/HRIS_M_command_bar');


			switch ($this->form['TYPE'])
			{
				case 'personal':
					$prm_employee_id = '';
					break;

				case 'list':
					$prm_employee_id = $this->input->post('txtinput[0]');
					break;
			}

			$return_value = array
				(
					'js_action_redirect'
					, $this->HRIS_M_command_bar->employee_action($this->input->post('txtinput[1]')).'/'.$prm_employee_id
				);


			$return_value = json_encode($return_value);
			echo $return_value;
		}
	}



/**
 * @section AJAX MODAL Action Section
 */

	/**
	 * @function ajx_modal_data_put()
	 * @description get the data from database and put them to the form via ajax!
	 */
	public function ajx_modal_data_put($prm_id = '', $prm_data_id = '')
	{
		if ($this->input->is_ajax_request() && $this->access_rights['EDIT'] && trim($prm_id) != '' && trim($prm_data_id) != '')
		{
			/**
			 * @description load the models
			 */
			$this->load->model('admin/M_live_data');


			switch ($this->form['NAME'])
			{
				case '_form_employment_general_leave':
					/**
					 * @description load the models
					 */
					$this->load->model('admin/hris/HRIS_M_live_data');


					$return_data = $this->HRIS_M_live_data->combo_data_get
						(
							'db_default'
							, array
								(
									'NAME' => $this->tbl_attr['TABLE_MODAL']['NAME']
									, 'WHERE' => array('data__id' => $prm_data_id)
									, 'FIELDS' => 'leave_management__id'
								)
						);

					$return_value = array
						(
							'js_action_data'
							, $return_data
							, 72
						);
					break;


				default:
					$return_value = $this->M_live_data->put
						(
							'db_default'
							, $this->tbl_attr['TABLE_MODAL']['NAME_ALIAS']
							, array('id' => $prm_id, 'data__id' => $prm_data_id)
							, $this->tbl_attr['FORM_MODAL']['FIELDS']
							, 70
							, 'log_form_edit'
							, 'modal'
						);
					break;
			}


			$return_value = json_encode($return_value);
			echo $return_value;
		}
	}


	/**
	 * @function ajx_modal_insert()
	 * @description insert the detail data
	 */
	public function ajx_modal_insert()
	{
		if ($this->input->is_ajax_request() && ($this->access_rights['ADD'] OR $this->access_rights['EDIT']))
		{
			/**
			 * @description load the models
			 */
			$this->load->model('admin/M_live_data');
			/**
			 * @description load the helper
			 */
			$this->load->helper('viewlist');


			/**
			 * @description process the header
			 */
			$header['ID'] = $this->input->post('txtinput[71]');



			/**
			 * @description process the detail
			 */
			switch ($this->form['NAME'])
			{
				case '_form_employment_general_leave':
					/**
					 * @description load the models
					 */
					$this->load->model('admin/hris/HRIS_M_live_data');


					$data = array();
					if (is_array($this->input->post('txtinput[72]')))
					{
						foreach ($this->input->post('txtinput[72]') as $leave_management_id)
						{
							$data[] = array
								(
									'data__id' => $header['ID']
									, 'leave_management__id' => $leave_management_id
								);
						}
					}
					$this->HRIS_M_live_data->combo_data_set
						(
							'db_default'
							, array
								(
									'NAME' => 'hris_employee_leave_management'
									, 'WHERE' => array('data__id' => $header['ID'])
								)
							, $data
						);

					$detail_return = array
						(
							'js_action_success'
							, array($this->lang->line('data_insert_success'), 'ok')
						);
					break;


				case '_form_information_family_dependant':
					$data = array
						(
							'data__id' => $this->input->post('txtinput[71]')
							, 'name' => $this->input->post('txtinput[72]')
							, 'relationship__id' => $this->input->post('txtinput[73]')
							, 'gender__id' => $this->input->post('txtinput[74]')
							, 'birth_place_city__id' => trim($this->input->post('txtinput[75]')) != '' ? $this->input->post('txtinput[75]') : NULL
							, 'birth_date' => $this->input->post('txtinput[76]')
							, 'occupation__id' => $this->input->post('txtinput[77]')
							, 'group_of_employee_status' => $this->input->post('txtinput[78]')
							, 'company_name' => $this->input->post('txtinput[79]')
							, 'marital_status__id' => $this->input->post('txtinput[80]')
							, 'education__id' => $this->input->post('txtinput[81]')
							, 'dependent_status' => $this->input->post('txtinput[82]')
							, 'phone' => $this->input->post('txtinput[83]')
							, 'address' => $this->input->post('txtinput[84]')
							, 'status' => $this->input->post('txtinput[85]')
						);

				default:
					$detail['KEY'] = array('id' => $this->input->post('txtinput[70]'), 'data__id' => $header['ID']);
					$detail_return = $this->M_live_data->insert
						(
							'db_default'
							, $this->tbl_attr['TABLE_MODAL']['NAME']
							, $detail['KEY']
							, (isset($data)) ? $data : $this->input->post('txtinput')
							, 'modal'
							, TRUE, ''
							, (isset($data)) ? FALSE : TRUE, TRUE
							, 70
						);
					break;
			}

			if ($detail_return[0] != 'js_action_success' && $this->access_rights['ADD'])
			{
				$modaldialog_status = '';
			}
			else
			{
				$modaldialog_status = 'modaldialog_close_auto';
			}



			/**
			 * @description generate the viewlist live!
			 */
			$return_value = array
				(
					'js_action_modal_insert'
					, $detail_return[1], array($header['ID'])

					/**
					 * @description the header id in the MODAL form, use it to sync with the main form
					 */
					, 70

					/**
					 * @description put the header data to main form after success inserting detail data
					 */
					, array('#txt0', $header['ID'])

					/**
					 * @description generate the detail view list, LIVE!
					 */
					, array
						(
							'content_replace'
							, detail_generate
								(
									'db_default'
									, $this->tbl_viewdetail_attr
									, array('data__id' => $this->input->post('txtinput[71]'))
									, $this->tbl_viewdetail_attr['JAVASCRIPT']['VIEWLIST_GENERATE']
								)
						)

					/**
					 * @description trigger the dialog to be automatically closed
					 */
					, array($modaldialog_status)
				);



			$return_value = json_encode($return_value);
			echo $return_value;
		}
	}


	/**
	 * @function ajx_modal_delete()
	 * @description delete the detail data
	 */
	public function ajx_modal_delete($prm_id = '', $prm_data_id = '', $prm_return_type = 'boolean')
	{
		if ($this->input->is_ajax_request() && $this->access_rights['DELETE'] && trim($prm_id) != '' && trim($prm_data_id) != '')
		{
			/**
			 * @description load the models
			 */
			$this->load->model('admin/M_live_data');


			$return_value = $this->M_live_data->delete
				(
					'db_default'
					, $this->tbl_attr['TABLE_MODAL']['NAME']
					, $prm_id.'/'.$prm_data_id
					, array()
					, $this->tbl_attr['TABLE_MODAL']['PRIMARY']['DATA']
					, 'modal'
					, FALSE
					, $prm_return_type
				);

			switch ($return_value)
			{
				case 'DELETE_SUCCESS':
					/**
					 * @description load the helper
					 */
					$this->load->helper('viewlist');


					$return_value = array
						(
							'js_action_content_replace'
							, array
								(
									'content_replace'
									, detail_generate
										(
											'db_default'
											, $this->tbl_viewdetail_attr
											, array('data__id' => $prm_data_id)
											, $this->tbl_viewdetail_attr['JAVASCRIPT']['VIEWLIST_GENERATE']
										)
								)
						);
					break;
			}


			$return_value = json_encode($return_value);
			echo $return_value;
		}
	}



/**
 * @section AJAX Live Section
 */

	/**
	 * @function ajx_live_employee_combo_put
	 * @description get the data and put them in combobox
	 */
	public function ajx_live_employee_combo_put($prm_object_start = '0', $prm_selected_value = '')
	{
		if ($this->input->is_ajax_request())
		{
			/**
			 * @description load the models
			 */
			$this->load->model('admin/hris/HRIS_M_live_data');


			$return_value = $this->HRIS_M_live_data->combo_fill('db_default', 'hris_employee_data', $prm_object_start, 'NORMAL', array(), FALSE, $prm_selected_value, FALSE);


			$return_value = json_encode($return_value);
			echo $return_value;
		}
	}


	/**
	 * @function ajx_live_area_combo_put()
	 * @description get the data and put them in combobox
	 */
	public function ajx_live_area_combo_put($prm_parent_id = '0', $prm_area_type_id = '', $prm_object_start = '0', $prm_selected_value = '')
	{
		if ($this->input->is_ajax_request() && trim($prm_area_type_id) != '')
		{
			/**
			 * @description load the models
			 */
			$this->load->model('admin/hris/HRIS_M_live_data');


			$return_value = $this->HRIS_M_live_data->combo_fill('db_default', 'hris_master_area', $prm_object_start, 'NORMAL', array_merge((is_numeric($prm_parent_id)) ? array('parent_id' => $prm_parent_id) : array(), array('area_type__id' => $prm_area_type_id)), TRUE, $prm_selected_value);


			$return_value = json_encode($return_value);
			echo $return_value;
		}
	}


	/**
	 * @function ajx_media_upload_file()
	 * @description upload the file
	 */
	public function ajx_media_upload_file()
	{
		/**
		 * @description load the settings
		 */
		$this->config->load(ENVIRONMENT.'/admin/hris_config', TRUE);
		$this->web_data['HRIS']['SETTINGS'] = $this->config->item(ENVIRONMENT.'/admin/hris_config');


		$upload_path = $this->web_data['HRIS']['SETTINGS']['HRIS_UPLOAD_DIR'].'/company/logo/';


		/**
		 * @description create the media folder if not exists
		 */
		if (is_dir($upload_path) == FALSE)
		{
			mkdir($upload_path, 0755);
		}
		$upload_path .= '/';

		/**
		 * @description upload configuration
		 */
		$upload_config = array
			(
				'upload_path' => $upload_path
				, 'allowed_types' => $this->web_data['HRIS']['SETTINGS']['HRIS_UPLOAD_TYPE_ALLOWED']
				, 'max_size' => $this->web_data['HRIS']['SETTINGS']['HRIS_UPLOAD_SIZE_MAX']
				, 'overwrite' => TRUE
			);
		$this->load->library('upload', $upload_config);
		$this->upload->initialize($upload_config);

		if ( ! $this->upload->do_upload('txtupload_file'))
		{
			$upload_result = $this->upload->data();

			/**
			 * @description let's allow the process without uploading the file :)
			 */
			if ($upload_result['file_size'] != 0)
			{
				$return_value = array
					(
						'js_upload_error'
						, array($this->upload->display_errors('', ''), 'error')
					);
			}
			else
			{
				$return_value = array
					(
						'js_upload_success'
						, array
							(
								'#txt20', ''
								, '#txt21', ''
							)
					);
			}
		}
		else
		{
			$upload_result = $this->upload->data();


			$return_value = array
				(
					'js_upload_success'
					, array
						(
							'#txt20', $upload_result['file_name']
							, '#txt21', $upload_result['file_type']
						)
				);
		}


		$return_value = json_encode($return_value);
		echo $return_value;
	}



/**
 * @section FORM Section
 */

	/**
	 * @function _form_information_summary
	 * @description generate the employee information summary form
	 */
	private function _form_information_summary()
	{
		/**
		 * TODO: call the information_data(); BUT when the employee job mapping already done; replace this!
		 */
		return $this->_form_information_data();
	}

	/**
	 * @function _form_information_data
	 * @description generate the employee information data form
	 */
	private function _form_information_data()
	{
	/**
	 * TODO: when the form is personal; this should be read_only or maybe disabled ??
	 */

		/**
		 * @description initialize the form elements
		 */
		$form_content_join[] = array
			(
				'<b>'.$this->lang->line('hris_employee_id').'</b><br /><small>'.$this->lang->line('fields_auto').'</small>'
				, array
					(
						'data' => form_input
							(
								array
								(
									'name' => 'txtinput[2]', 'id' => 'txt2'
									, 'size' => '30', 'maxlength' => '20'
									, 'readOnly' => 'readOnly' , 'class' => '{validate: {required: true}} read_only bold'
								)
							)
						, 'colspan' => 3
					)

				, '<b>'.$this->lang->line('hris_employee_number').'</b><br /><small>'.$this->lang->line('fields_auto').'</small>'
				, array
					(
						'data' => form_input
							(
								array
								(
									'name' => 'txtinput[3]', 'id' => 'txt3'
									, 'size' => '30', 'maxlength' => '20'
									, 'readOnly' => 'readOnly' , 'class' => '{validate: {required: true}} read_only bold'
								)
							)
						, 'colspan' => 3
					)

				, '<b>'.$this->lang->line('hris_name').'</b><br /><small>'.$this->lang->line('fields_required').'</small>'
				, array
					(
						'data' => form_input
							(
								array
								(
									'name' => 'txtinput[4]', 'id' => 'txt4'
									, 'size' => '20', 'maxlength' => '20'
									, 'class' => '{validate: {required: true}}'
								)
								, $this->lang->line('hris_employee_name_first')
							)
							. '&nbsp;'
							. form_input
								(
									array
									(
										'name' => 'txtinput[5]', 'id' => 'txt5'
										, 'size' => '20', 'maxlength' => '20'
									)
									, $this->lang->line('hris_employee_name_middle')
								)
							. '&nbsp;'
							. form_input
								(
									array
									(
										'name' => 'txtinput[6]', 'id' => 'txt6'
										, 'size' => '20', 'maxlength' => '20'
									)
									, $this->lang->line('hris_employee_name_last')
								)
						, 'colspan' => 3
					)
			);

		$form_content[] = array
			(
				'<b>'.$this->lang->line('hris_employee_name_official').'</b>'
				, form_input
					(
						array
						(
							'name' => 'txtinput[7]', 'id' => 'txt7'
							, 'size' => '60', 'maxlength' => '60'
							, 'readOnly' => 'readOnly', 'class' => '{validate: {required: true}} read_only'
						)
					)

				, '<b>'.$this->lang->line('hris_employee_name_nick').'</b>'
				, form_input
					(
						array
						(
							'name' => 'txtinput[8]', 'id' => 'txt8'
							, 'size' => '20', 'maxlength' => '20'
						)
					)

				, '<b>'.$this->lang->line('hris_salutation').'</b>'
				, form_dropdown
					(
						'txtinput[9]'
						, $this->HRIS_M_live_data->combo_fill('db_default', 3)
						, ''
						, 'id="txt9" class="{validate: {required: true}}"'
					)

				, '<b>'.$this->lang->line('hris_nationality').'</b>'
				, form_dropdown
					(
						'txtinput[10]'
						, $this->HRIS_M_live_data->combo_fill('db_default', 41)
						, ''
						, 'id="txt10" class="{validate: {required: true}}"'
					)

				, '<b>'.$this->lang->line('hris_employee_birth_place').'</b><br /><small>'.$this->lang->line('fields_required').'</small>'
				, form_dropdown
					(
						'txtinput[11]'
						, array('' => $this->lang->line('hris_choose'))
						, ''
						, 'id="txt11" class="{validate: {required: true}}"'
					)

				, '<b>'.$this->lang->line('hris_employee_birth_date').'</b>'
				, form_input
					(
						array
						(
							'name' => 'txtinput[12]', 'id' => 'txt12'
							, 'size' => '11', 'maxlength' => '10'
							, 'readOnly' => 'readOnly', 'class' => '{validate: {required: true}} input_calendar do_not_change'
						)
						, date('Y-m-d')
						, 'onBlur="javascript: calendar.hide();"'
					)

				, '<b>'.$this->lang->line('hris_gender').'</b>'
				, form_dropdown
					(
						'txtinput[13]'
						, $this->HRIS_M_live_data->combo_fill('db_default', 38, '', 'NORMAL', array('id !=' => 221))
						, ''
						, 'id="txt13" class="{validate: {required: true}}"'
					)

				, '<b>'.$this->lang->line('hris_religion').'</b>'
				, form_dropdown
					(
						'txtinput[14]'
						, $this->HRIS_M_live_data->combo_fill('db_default', 1)
						, ''
						, 'id="txt14" class="{validate: {required: true}}"'
					)
			);

		$form_content_join[] = array
			(
				'<b>'.$this->lang->line('hris_marital_status').'</b>'
				, array
					(
						'data' => form_dropdown
							(
								'txtinput[15]'
								, $this->HRIS_M_live_data->combo_fill('db_default', 2)
								, ''
								, 'id="txt15" class="{validate: {required: true}}"'
							)
						, 'colspan' => 3
					)
			);

		$form_content[] = array
			(
				'<b>'.$this->lang->line('hris_employee_marital_place').'</b>'
				, form_input
					(
						array
						(
							'name' => 'txtinput[16]', 'id' => 'txt16'
							, 'size' => '30', 'maxlength' => '30'
						)
					)

				, '<b>'.$this->lang->line('hris_employee_marital_date').'</b>'
				, form_input
					(
						array
						(
							'name' => 'txtinput[17]', 'id' => 'txt17'
							, 'size' => '11', 'maxlength' => '10'
							, 'readOnly' => 'readOnly', 'class' => '{validate: {required: true}} input_calendar do_not_change'
						)
						, date('Y-m-d')
						, 'onBlur="javascript: calendar.hide();"'
					)

				, '<b>'.$this->lang->line('hris_employee_id_card_number').'</b><br /><small>'.$this->lang->line('fields_required').'</small>'
				, form_input
					(
						array
						(
							'name' => 'txtinput[18]', 'id' => 'txt18'
							, 'size' => '30', 'maxlength' => '30'
							, 'class' => '{validate: {required: true}}'
						)
					)

				, '<b>'.$this->lang->line('hris_employee_id_card_expire').'</b>'
				, form_input
					(
						array
						(
							'name' => 'txtinput[19]', 'id' => 'txt19'
							, 'size' => '11', 'maxlength' => '10'
							, 'readOnly' => 'readOnly', 'class' => '{validate: {required: true}} input_calendar do_not_change'
						)
						, date('Y-m-d')
						, 'onBlur="javascript: calendar.hide();"'
					)

				, '<b>'.$this->lang->line('hris_employee_tax_id').'</b><br /><small>'.$this->lang->line('fields_required').'</small>'
				, form_input
					(
						array
						(
							'name' => 'txtinput[20]', 'id' => 'txt20'
							, 'size' => '30', 'maxlength' => '30'
							, 'class' => '{validate: {required: true}}'
						)
					)

				, '<b>'.$this->lang->line('hris_tax_type').'</b>'
				, form_dropdown
					(
						'txtinput[21]'
						, $this->HRIS_M_live_data->combo_fill('db_default', 11)
						, ''
						, 'id="txt21" class="{validate: {required: true}}"'
					)


					. form_submit
						(
							array('id' => 'btn_save', 'class' => 'hidden')
							, $this->lang->line('button_save')
						)
			);
		/**
		 * @description create the form and elements
		 */
		$this->table->clear();
		$table_template = array('table_open' => '<table>');
		$this->table->set_template($table_template);

		$form[] = $this->table->make_columns($form_content_join[0], $this->tbl_attr['FORM']['COLUMN_JOIN']);
		$form[] = $this->table->make_columns($form_content[0], $this->tbl_attr['FORM']['COLUMN']);
		$form[] = $this->table->make_columns($form_content_join[1], $this->tbl_attr['FORM']['COLUMN_JOIN']);
		$form[] = $this->table->make_columns($form_content[1], $this->tbl_attr['FORM']['COLUMN']);

		$form_content = $this->table->generate(array_merge($form[0], $form[1], $form[2], $form[3]));


		return $form_content;
	}


	/**
	 * @function _form_modal
	 * @description generate the form modaldialog
	 */
	private function _form_modal()
	{
		/**
		 * @description initialize the form elements
		 */
		$form_content = array
			(
				(
					$this->access_rights['ADD']
					? form_button
						(
							array('id' => 'btn_add_detail', 'class' => 'input_default hidden')
							, $this->lang->line('button_add_detail')
						)
					: NULL
				)
				. form_submit
					(
						array('id' => 'btn_save', 'class' => 'input_not_default hidden')
						, $this->lang->line('button_save')
					)
			);


		/**
		 * @description create the form and elements
		 */
		$this->table->clear();
		$table_template = array('table_open' => '<table class = "plain hidden">');
		$this->table->set_template($table_template);

		$form_content = $this->table->make_columns($form_content, $this->tbl_attr['FORM']['COLUMN']);
		$form_content = $this->table->generate($form_content);


		return $form_content;
	}


	/**
	 * @function form_modal_information_address
	 * @description generate the information address modaldialog form
	 */
	public function form_modal_information_address($prm_employee_id = '')
	{
		if ($this->input->is_ajax_request() && ($this->access_rights['ADD'] OR $this->access_rights['EDIT']))
		{
			/**
			 * @description load the models
			 */
			$this->load->model(array('admin/M_layout', 'admin/hris/HRIS_M_live_data'));


			/**
			 * @section begin form MODAL initalize
			 */
				/**
				 * @description create the MODAL form and elements
				 */
				$form_modal_content_join[] = array
					(
						array('data' => '<b>'.$this->lang->line('hris_address').'</b><br /><small>'.$this->lang->line('fields_required').'</small>', 'valign' => 'top')
						, array
							(
								'data' => form_input
									(
										array
										(
											'type' => 'hidden'
											, 'name' => 'txtinput[70]', 'id' => 'txt70'
											, 'size' => '20', 'maxlength' => '20'
											, 'readOnly' => 'readOnly', 'class' => 'read_only'
										)
									)
									. form_input
										(
											array
											(
												'type' => 'hidden'
												, 'name' => 'txtinput[71]', 'id' => 'txt71'
												, 'size' => '20', 'maxlength' => '20'
												, 'readOnly' => 'readOnly', 'class' => '{validate: {required: true}} read_only do_not_change'
											)
											, $prm_employee_id
										)
									. form_textarea
										(
											array
											(
												'name' => 'txtinput[72]', 'id' => 'txt72'
												, 'cols' => '60', 'rows' => '3'
												, 'class' => '{validate: {required: true}}'
											)
										)
								, 'colspan' => 3
							)
					);

				$form_modal_content[] = array
					(
						'<b>'.$this->lang->line('hris_employee_address_rt').'</b>'
						, form_input
							(
								array
								(
									'name' => 'txtinput[73]', 'id' => 'txt73'
									, 'size' => '3', 'maxlength' => '3'
								)
							)

						, '<b>'.$this->lang->line('hris_employee_address_rw').'</b>'
						, form_input
							(
								array
								(
									'name' => 'txtinput[74]', 'id' => 'txt74'
									, 'size' => '3', 'maxlength' => '3'
								)
							)
					);

				$form_modal_content_join[] = array
					(
						'<b>'.$this->lang->line('hris_area_country').'</b>'
						, array
							(
								'data' => form_dropdown
									(
										'txtinput[75]'
										, $this->HRIS_M_live_data->combo_fill('db_default', 'hris_master_area', '', 'NORMAL', array('parent_id' => 0))
										, ''
										, 'id="txt75" class="{validate: {required: true}}"'
									)
								, 'colspan' => 3
							)
					);

				$form_modal_content[] = array
					(
						'<b>'.$this->lang->line('hris_area_province').'</b>'
						, form_dropdown
							(
								'txtinput[76]'
								, array('' => $this->lang->line('hris_choose'))
								, ''
								, 'id="txt76" class="{validate: {required: true}}"'
							)

						, '<b>'.$this->lang->line('hris_area_city').'</b>'
						, form_dropdown
							(
								'txtinput[77]'
								, array('' => $this->lang->line('hris_choose'))
								, ''
								, 'id="txt77" class="{validate: {required: true}}"'
							)

						, '<b>'.$this->lang->line('hris_area_regency').'</b>'
						, form_dropdown
							(
								'txtinput[78]'
								, array('' => $this->lang->line('hris_choose'))
								, ''
								, 'id="txt78" class="{validate: {required: true}}"'
							)

						, '<b>'.$this->lang->line('hris_area_sub_district').'</b>'
						, form_dropdown
							(
								'txtinput[79]'
								, array('' => $this->lang->line('hris_choose'))
								, ''
								, 'id="txt79" class="{validate: {required: true}}"'
							)

						, '<b>'.$this->lang->line('hris_zipcode').'</b>'
						, form_input
							(
								array
								(
									'name' => 'txtinput[80]', 'id' => 'txt80'
									, 'size' => '5', 'maxlength' => '5'
								)
							)

						, '<b>'.$this->lang->line('hris_phone').'</b>'
						, form_input
							(
								array
								(
									'name' => 'txtinput[81]', 'id' => 'txt81'
									, 'size' => '20', 'maxlength' => '20'
								)
							)

						, '<b>'.$this->lang->line('hris_address_ownership').'</b>'
						, form_dropdown
							(
								'txtinput[82]'
								, $this->HRIS_M_live_data->combo_fill('db_default', 25)
								, ''
								, 'id="txt82" class="{validate: {required: true}}"'
							)

						, '<b>'.$this->lang->line('hris_address_stayed_status').'</b>'
						, form_dropdown
							(
								'txtinput[83]'
								, $this->HRIS_M_live_data->combo_fill('db_default', 26)
								, ''
								, 'id="txt83" class="{validate: {required: true}}"'
							)

						, '<b>'.$this->lang->line('hris_employee_address_distance').'</b>'
						, form_input
							(
								array
								(
									'name' => 'txtinput[84]', 'id' => 'txt84'
									, 'size' => '5', 'maxlength' => '5'
									, 'class' => '{validate: {number: true, min: 1}} input_right'
								)
							)

						, '<b>'.$this->lang->line('hris_status').'</b>'
						, form_dropdown
							(
								'txtinput[85]'
								, array
									(
										'Current' => $this->lang->line('hris_current')
										, 'N/A' => $this->lang->line('hris_not_available')
									)
								, ''
								, 'id="txt85"'
							)


						, '&nbsp;'
						, form_submit
							(
								array('id' => 'btn_modal_save')
								, $this->lang->line('button_save')
							)
					);
				/**
				 * @description create the form MODAL and elements
				 */
				$this->table->clear();
				$form[] = $this->table->make_columns($form_modal_content_join[0], $this->tbl_attr['FORM_MODAL']['COLUMN_JOIN']);
				$form[] = $this->table->make_columns($form_modal_content[0], $this->tbl_attr['FORM_MODAL']['COLUMN']);
				$form[] = $this->table->make_columns($form_modal_content_join[1], $this->tbl_attr['FORM_MODAL']['COLUMN_JOIN']);
				$form[] = $this->table->make_columns($form_modal_content[1], $this->tbl_attr['FORM_MODAL']['COLUMN']);

				$form_modal_content = $this->table->generate(array_merge($form[0], $form[1], $form[2], $form[3]));
			/**
			 * @section end form MODAL initalize
			 */


			/**
			 * @section begin generate template variables
			 */
			$return_value = array
				(
					/**
					 * @description form modal dialogs
					 */
					'FORM_MODAL' => array
						(
							'OPEN' => form_open('', array('id' => 'frm_modal', 'onSubmit' => 'return false'), '')
							, 'TITLE' => $this->tbl_attr['FORM_MODAL']['HEADING']
							, 'CONTENT' => $form_modal_content
						)

					/**
					 * @description notes modaldialog
					 */
					, 'NOTES_MODAL' => array
						(
							'USE' => 'TRUE'
							, 'MESSAGE' => array
								(
									'SHORTCUTS' => $this->lang->line('notes_modaldialog_shortcuts')
									, 'ADDITIONAL' => ''
								)
						)
				);
			/**
			 * @section end generate template variables
			 */


			$return_value = $this->M_layout->modaldialog_generate($return_value);
			echo $return_value;
		}
	}


	/**
	 * @function form_modal_information_email
	 * @description generate the information email modaldialog form
	 */
	public function form_modal_information_email($prm_employee_id = '')
	{
		if ($this->input->is_ajax_request() && ($this->access_rights['ADD'] OR $this->access_rights['EDIT']))
		{
			/**
			 * @description load the models
			 */
			$this->load->model('admin/M_layout');


			/**
			 * @section begin form MODAL initalize
			 */
				/**
				 * @description create the MODAL form and elements
				 */
				$form_modal_content = array
					(
						'<b>'.$this->lang->line('hris_email').'</b><br /><small>'.$this->lang->line('fields_required').'</small>'
						, form_input
							(
								array
								(
									'type' => 'hidden'
									, 'name' => 'txtinput[70]', 'id' => 'txt70'
									, 'size' => '20', 'maxlength' => '20'
									, 'readOnly' => 'readOnly', 'class' => 'read_only'
								)
							)
							. form_input
								(
									array
									(
										'type' => 'hidden'
										, 'name' => 'txtinput[71]', 'id' => 'txt71'
										, 'size' => '20', 'maxlength' => '20'
										, 'readOnly' => 'readOnly', 'class' => '{validate: {required: true}} read_only do_not_change'
									)
									, $prm_employee_id
								)
							. form_input
								(
									array
									(
										'name' => 'txtinput[72]', 'id' => 'txt72'
										, 'size' => '60', 'maxlength' => '60'
										, 'class' => '{validate: {email: true}}'
									)
								)

						, '<b>'.$this->lang->line('hris_status').'</b>'
						, form_dropdown
							(
								'txtinput[73]'
								, array
									(
										'Active' => $this->lang->line('hris_active')
										, 'N/A' => $this->lang->line('hris_not_available')
									)
								, ''
								, 'id="txt73"'
							)


						, '&nbsp;'
						, form_submit
							(
								array('id' => 'btn_modal_save')
								, $this->lang->line('button_save')
							)
					);
				/**
				 * @description create the form MODAL and elements
				 */
				$this->table->clear();
				$form_modal_content = $this->table->make_columns($form_modal_content, $this->tbl_attr['FORM_MODAL']['COLUMN']);
				$form_modal_content = $this->table->generate($form_modal_content);
			/**
			 * @section end form MODAL initalize
			 */


			/**
			 * @section begin generate template variables
			 */
			$return_value = array
				(
					/**
					 * @description form modal dialogs
					 */
					'FORM_MODAL' => array
						(
							'OPEN' => form_open('', array('id' => 'frm_modal', 'onSubmit' => 'return false'), '')
							, 'TITLE' => $this->tbl_attr['FORM_MODAL']['HEADING']
							, 'CONTENT' => $form_modal_content
						)

					/**
					 * @description notes modaldialog
					 */
					, 'NOTES_MODAL' => array
						(
							'USE' => 'TRUE'
							, 'MESSAGE' => array
								(
									'SHORTCUTS' => $this->lang->line('notes_modaldialog_shortcuts')
									, 'ADDITIONAL' => ''
								)
						)
				);
			/**
			 * @section end generate template variables
			 */


			$return_value = $this->M_layout->modaldialog_generate($return_value);
			echo $return_value;
		}
	}


	/**
	 * @function form_modal_information_phone
	 * @description generate the information phone modaldialog form
	 */
	public function form_modal_information_phone($prm_employee_id = '')
	{
		if ($this->input->is_ajax_request() && ($this->access_rights['ADD'] OR $this->access_rights['EDIT']))
		{
			/**
			 * @description load the models
			 */
			$this->load->model('admin/M_layout');


			/**
			 * @section begin form MODAL initalize
			 */
				/**
				 * @description create the MODAL form and elements
				 */
				$form_modal_content = array
					(
						'<b>'.$this->lang->line('hris_type').'</b>'
						, form_input
							(
								array
								(
									'type' => 'hidden'
									, 'name' => 'txtinput[70]', 'id' => 'txt70'
									, 'size' => '20', 'maxlength' => '20'
									, 'readOnly' => 'readOnly', 'class' => 'read_only'
								)
							)
							. form_input
								(
									array
									(
										'type' => 'hidden'
										, 'name' => 'txtinput[71]', 'id' => 'txt71'
										, 'size' => '20', 'maxlength' => '20'
										, 'readOnly' => 'readOnly', 'class' => '{validate: {required: true}} read_only do_not_change'
									)
									, $prm_employee_id
								)
							. form_dropdown
								(
									'txtinput[72]'
									, array
										(
											'Phone' => $this->lang->line('hris_phone')
											, 'Mobile' => $this->lang->line('hris_mobile')
										)
									, ''
									, 'id="txt72"'
								)

						, '<b>'.$this->lang->line('hris_phone').'</b><br /><small>'.$this->lang->line('fields_required').'</small>'
						, form_input
							(
								array
								(
									'name' => 'txtinput[73]', 'id' => 'txt73'
									, 'size' => '20', 'maxlength' => '20'
									, 'class' => '{validate: {required: true}}'
								)
							)

						, '<b>'.$this->lang->line('hris_status').'</b>'
						, form_dropdown
							(
								'txtinput[74]'
								, array
									(
										'Active' => $this->lang->line('hris_active')
										, 'N/A' => $this->lang->line('hris_not_available')
									)
								, ''
								, 'id="txt74"'
							)


						, '&nbsp;'
						, form_submit
							(
								array('id' => 'btn_modal_save')
								, $this->lang->line('button_save')
							)
					);
				/**
				 * @description create the form MODAL and elements
				 */
				$this->table->clear();
				$form_modal_content = $this->table->make_columns($form_modal_content, $this->tbl_attr['FORM_MODAL']['COLUMN']);
				$form_modal_content = $this->table->generate($form_modal_content);
			/**
			 * @section end form MODAL initalize
			 */


			/**
			 * @section begin generate template variables
			 */
			$return_value = array
				(
					/**
					 * @description form modal dialogs
					 */
					'FORM_MODAL' => array
						(
							'OPEN' => form_open('', array('id' => 'frm_modal', 'onSubmit' => 'return false'), '')
							, 'TITLE' => $this->tbl_attr['FORM_MODAL']['HEADING']
							, 'CONTENT' => $form_modal_content
						)

					/**
					 * @description notes modaldialog
					 */
					, 'NOTES_MODAL' => array
						(
							'USE' => 'TRUE'
							, 'MESSAGE' => array
								(
									'SHORTCUTS' => $this->lang->line('notes_modaldialog_shortcuts')
									, 'ADDITIONAL' => ''
								)
						)
				);
			/**
			 * @section end generate template variables
			 */


			$return_value = $this->M_layout->modaldialog_generate($return_value);
			echo $return_value;
		}
	}


	/**
	 * @function form_modal_information_family_dependant
	 * @description generate the information family modaldialog form
	 */
	public function form_modal_information_family_dependant($prm_employee_id = '')
	{
		if ($this->input->is_ajax_request() && ($this->access_rights['ADD'] OR $this->access_rights['EDIT']))
		{
			/**
			 * @description load the models
			 */
			$this->load->model(array('admin/M_layout', 'admin/hris/HRIS_M_live_data'));


			/**
			 * @section begin form MODAL initalize
			 */
				/**
				 * @description create the MODAL form and elements
				 */
				$form_modal_content_join[] = array
					(
						'<b>'.$this->lang->line('hris_name').'</b><br /><small>'.$this->lang->line('fields_required').'</small>'
						, array
							(
								'data' => form_input
									(
										array
										(
											'type' => 'hidden'
											, 'name' => 'txtinput[70]', 'id' => 'txt70'
											, 'size' => '20', 'maxlength' => '20'
											, 'readOnly' => 'readOnly', 'class' => 'read_only'
										)
									)
									. form_input
										(
											array
											(
												'type' => 'hidden'
												, 'name' => 'txtinput[71]', 'id' => 'txt71'
												, 'size' => '20', 'maxlength' => '20'
												, 'readOnly' => 'readOnly', 'class' => '{validate: {required: true}} read_only do_not_change'
											)
											, $prm_employee_id
										)
									. form_input
										(
											array
											(
												'name' => 'txtinput[72]', 'id' => 'txt72'
												, 'size' => '30', 'maxlength' => '30'
												, 'class' => '{validate: {required: true}}'
											)
										)
								, 'colspan' => 3
							)
					);

				$form_modal_content[] = array
					(
						'<b>'.$this->lang->line('hris_family_relationship').'</b>'
						, form_dropdown
							(
								'txtinput[73]'
								, $this->HRIS_M_live_data->combo_fill('db_default', 4)
								, ''
								, 'id="txt73" class="{validate: {required: true}}"'
							)

						, '<b>'.$this->lang->line('hris_gender').'</b>'
						, form_dropdown
							(
								'txtinput[74]'
								, $this->HRIS_M_live_data->combo_fill('db_default', 38, '', 'NORMAL', array('id !=' => 221))
								, ''
								, 'id="txt74" class="{validate: {required: true}}"'
							)

						, '<b>'.$this->lang->line('hris_employee_birth_place').'</b>'
						, form_dropdown
							(
								'txtinput[75]'
								, array('' => $this->lang->line('hris_choose'))
								, ''
								, 'id="txt75"'
							)

						, '<b>'.$this->lang->line('hris_employee_birth_date').'</b>'
						, form_input
							(
								array
								(
									'name' => 'txtinput[76]', 'id' => 'txt76'
									, 'size' => '11', 'maxlength' => '10'
									, 'readOnly' => 'readOnly', 'class' => '{validate: {required: true}} input_calendar do_not_change'
								)
								, date('Y-m-d')
								, 'onBlur="javascript: calendar.hide();"'
							)

						, '<b>'.$this->lang->line('hris_occupation').'</b>'
						, form_dropdown
							(
								'txtinput[77]'
								, $this->HRIS_M_live_data->combo_fill('db_default', 5)
								, ''
								, 'id="txt77" class="{validate: {required: true}}"'
							)

						, '<b>'.$this->lang->line('hris_employee_family_group_of_employee').'</b>'
						, form_dropdown
							(
								'txtinput[78]'
								, array
									(
										'Yes' => $this->lang->line('hris_yes')
										, 'No' => $this->lang->line('hris_no')
									)
								, ''
								, 'id="txt78"'
							)

						, '<b>'.$this->lang->line('hris_company_name').'</b>'
						, form_input
							(
								array
								(
									'name' => 'txtinput[79]', 'id' => 'txt79'
									, 'size' => '35', 'maxlength' => '35'
								)
							)

						, '<b>'.$this->lang->line('hris_marital_status').'</b>'
						, form_dropdown
							(
								'txtinput[80]'
								, $this->HRIS_M_live_data->combo_fill('db_default', 2)
								, ''
								, 'id="txt80" class="{validate: {required: true}}"'
							)

						, '<b>'.$this->lang->line('hris_education').'</b>'
						, form_dropdown
							(
								'txtinput[81]'
								, $this->HRIS_M_live_data->combo_fill('db_default', 8)
								, ''
								, 'id="txt81" class="{validate: {required: true}}"'
							)

						, '<b>'.$this->lang->line('hris_employee_family_dependant').'</b>'
						, form_dropdown
							(
								'txtinput[82]'
								, array
									(
										'Yes' => $this->lang->line('hris_yes')
										, 'No' => $this->lang->line('hris_no')
									)
								, ''
								, 'id="txt82"'
							)

						, '<b>'.$this->lang->line('hris_phone').'</b>'
						, form_input
							(
								array
								(
									'name' => 'txtinput[83]', 'id' => 'txt83'
									, 'size' => '20', 'maxlength' => '20'
								)
							)
					);

				$form_modal_content_join[] = array
					(
						array('data' => '<b>'.$this->lang->line('hris_address').'</b><br /><small>'.$this->lang->line('fields_required').'</small>', 'valign' => 'top')
						, array
							(
								'data' => form_textarea
									(
										array
										(
											'name' => 'txtinput[84]', 'id' => 'txt84'
											, 'cols' => '80', 'rows' => '3'
											, 'class' => '{validate: {required: true}}'
										)
									)
								, 'colspan' => 3
							)

						, '<b>'.$this->lang->line('hris_status').'</b>'
						, array
							(
								'data' => form_dropdown
									(
										'txtinput[85]'
										, array
											(
												'Alive' => $this->lang->line('hris_alive')
												, 'Deceased' => $this->lang->line('hris_deceased')
											)
										, ''
										, 'id="txt85"'
									)
								, 'colspan' => 3
							)


						, '&nbsp;'
						, array
							(
								'data' => form_submit
									(
										array('id' => 'btn_modal_save')
										, $this->lang->line('button_save')
									)
								, 'colspan' => 3
							)
					);
				/**
				 * @description create the form MODAL and elements
				 */
				$this->table->clear();
				$form[] = $this->table->make_columns($form_modal_content_join[0], $this->tbl_attr['FORM_MODAL']['COLUMN_JOIN']);
				$form[] = $this->table->make_columns($form_modal_content[0], $this->tbl_attr['FORM_MODAL']['COLUMN']);
				$form[] = $this->table->make_columns($form_modal_content_join[1], $this->tbl_attr['FORM_MODAL']['COLUMN_JOIN']);

				$form_modal_content = $this->table->generate(array_merge($form[0], $form[1], $form[2]));
			/**
			 * @section end form MODAL initalize
			 */


			/**
			 * @section begin generate template variables
			 */
			$return_value = array
				(
					/**
					 * @description form modal dialogs
					 */
					'FORM_MODAL' => array
						(
							'OPEN' => form_open('', array('id' => 'frm_modal', 'onSubmit' => 'return false'), '')
							, 'TITLE' => $this->tbl_attr['FORM_MODAL']['HEADING']
							, 'CONTENT' => $form_modal_content
						)

					/**
					 * @description notes modaldialog
					 */
					, 'NOTES_MODAL' => array
						(
							'USE' => 'TRUE'
							, 'MESSAGE' => array
								(
									'SHORTCUTS' => $this->lang->line('notes_modaldialog_shortcuts')
									, 'ADDITIONAL' => ''
								)
						)
				);
			/**
			 * @section end generate template variables
			 */


			$return_value = $this->M_layout->modaldialog_generate($return_value);
			echo $return_value;
		}
	}


	/**
	 * @function form_modal_information_education
	 * @description generate the information education modaldialog form
	 */
	public function form_modal_information_education($prm_employee_id = '')
	{
		if ($this->input->is_ajax_request() && ($this->access_rights['ADD'] OR $this->access_rights['EDIT']))
		{
			/**
			 * @description load the models
			 */
			$this->load->model(array('admin/M_layout', 'admin/hris/HRIS_M_live_data'));


			/**
			 * @section begin form MODAL initalize
			 */
				/**
				 * @description create the MODAL form and elements
				 */
				$form_modal_content_join[] = array
					(
						'<b>'.$this->lang->line('hris_education').'</b>'
						, array
							(
								'data' => form_input
									(
										array
										(
											'type' => 'hidden'
											, 'name' => 'txtinput[70]', 'id' => 'txt70'
											, 'size' => '20', 'maxlength' => '20'
											, 'readOnly' => 'readOnly', 'class' => 'read_only'
										)
									)
									. form_input
										(
											array
											(
												'type' => 'hidden'
												, 'name' => 'txtinput[71]', 'id' => 'txt71'
												, 'size' => '20', 'maxlength' => '20'
												, 'readOnly' => 'readOnly', 'class' => '{validate: {required: true}} read_only do_not_change'
											)
											, $prm_employee_id
										)
									. form_dropdown
										(
											'txtinput[72]'
											, $this->HRIS_M_live_data->combo_fill('db_default', 8)
											, ''
											, 'id="txt72" class="{validate: {required: true}}"'
										)
								, 'colspan' => 3
							)
					);

				$form_modal_content[] = array
					(
						'<b>'.$this->lang->line('hris_start').'</b>'
						, form_dropdown
							(
								'txtinput[73]'
								, $this->HRIS_M_live_data->combo_year()
								, date('Y')
								, 'id="txt73" class="{validate: {required: true}}"'
							)

						, '<b>'.$this->lang->line('hris_end').'</b>'
						, form_dropdown
							(
								'txtinput[74]'
								, $this->HRIS_M_live_data->combo_year()
								, date('Y')
								, 'id="txt74" class="{validate: {required: true}}"'
							)
					);

				$form_modal_content_join[] = array
					(
						'<b>'.$this->lang->line('hris_instantion_institution').'</b>'
						, array
							(
								'data' => form_dropdown
									(
										'txtinput[75]'
										, $this->HRIS_M_live_data->combo_fill('db_default', 'hris_master_instantion', '', 'NORMAL', array('instantion_type__id' => 135))
										, ''
										, 'id="txt75" class="{validate: {required: true}}"'
									)
								, 'colspan' => 3
							)
					);

				$form_modal_content[] = array
					(
						'<b>'.$this->lang->line('hris_faculty').'</b>'
						, form_dropdown
							(
								'txtinput[76]'
								, $this->HRIS_M_live_data->combo_fill('db_default', 9)
								, ''
								, 'id="txt76" class="{validate: {required: true}}"'
							)

						, '<b>'.$this->lang->line('hris_mayor').'</b>'
						, form_dropdown
							(
								'txtinput[77]'
								, $this->HRIS_M_live_data->combo_fill('db_default', 10)
								, ''
								, 'id="txt77" class="{validate: {required: true}}"'
							)
					);

				$form_modal_content_join[] = array
					(
						'<b>'.$this->lang->line('hris_area_country').'</b>'
						, array
							(
								'data' => form_dropdown
									(
										'txtinput[78]'
										, $this->HRIS_M_live_data->combo_fill('db_default', 'hris_master_area', '', 'NORMAL', array('parent_id' => 0))
										, ''
										, 'id="txt78" class="{validate: {required: true}}"'
									)
								, 'colspan' => 3
							)
					);

				$form_modal_content[] = array
					(
						'<b>'.$this->lang->line('hris_area_province').'</b>'
						, form_dropdown
							(
								'txtinput[79]'
								, array('' => $this->lang->line('hris_choose'))
								, ''
								, 'id="txt79" class="{validate: {required: true}}"'
							)

						, '<b>'.$this->lang->line('hris_area_city').'</b>'
						, form_dropdown
							(
								'txtinput[80]'
								, array('' => $this->lang->line('hris_choose'))
								, ''
								, 'id="txt80" class="{validate: {required: true}}"'
							)

						, '<b>'.$this->lang->line('hris_employee_education_gpa_get').'</b>'
						, form_input
							(
								array
								(
									'name' => 'txtinput[81]', 'id' => 'txt81'
									, 'size' => '5', 'maxlength' => '5'
									, 'class' => '{validate: {number: true, min: 0}} input_right'
								)
								, '0'
							)

						, '<b>'.$this->lang->line('hris_max').'</b>'
						, form_input
							(
								array
								(
									'name' => 'txtinput[82]', 'id' => 'txt82'
									, 'size' => '5', 'maxlength' => '5'
									, 'class' => '{validate: {number: true, min: 0}} input_right'
								)
								, '0'
							)

						, '<b>'.$this->lang->line('hris_employee_education_certificate').'</b>'
						, form_dropdown
							(
								'txtinput[83]'
								, array
									(
										'Yes' => $this->lang->line('hris_yes')
										, 'No' => $this->lang->line('hris_no')
									)
								, ''
								, 'id="txt83"'
							)

						, '<b>'.$this->lang->line('hris_employee_education_certificate').' '.$this->lang->line('hris_number').'</b>'
						, form_input
							(
								array
								(
									'name' => 'txtinput[84]', 'id' => 'txt84'
									, 'size' => '30', 'maxlength' => '30'
								)
							)

						, '<b>'.$this->lang->line('hris_employee_education_certificate').' '.$this->lang->line('hris_date').'</b>'
						, form_input
							(
								array
								(
									'name' => 'txtinput[85]', 'id' => 'txt85'
									, 'size' => '11', 'maxlength' => '10'
									, 'readOnly' => 'readOnly', 'class' => '{validate: {required: true}} input_calendar do_not_change'
								)
								, date('Y-m-d')
								, 'onBlur="javascript: calendar.hide();"'
							)

						, '<b>'.$this->lang->line('hris_default').'</b>'
						, form_dropdown
							(
								'txtinput[86]'
								, array
									(
										'Yes' => $this->lang->line('hris_yes')
										, 'No' => $this->lang->line('hris_no')
									)
								, ''
								, 'id="txt86"'
							)


						, '&nbsp;'
						, form_submit
							(
								array('id' => 'btn_modal_save')
								, $this->lang->line('button_save')
							)
					);
				/**
				 * @description create the form MODAL and elements
				 */
				$this->table->clear();
				$form[] = $this->table->make_columns($form_modal_content_join[0], $this->tbl_attr['FORM_MODAL']['COLUMN_JOIN']);
				$form[] = $this->table->make_columns($form_modal_content[0], $this->tbl_attr['FORM_MODAL']['COLUMN']);
				$form[] = $this->table->make_columns($form_modal_content_join[1], $this->tbl_attr['FORM_MODAL']['COLUMN_JOIN']);
				$form[] = $this->table->make_columns($form_modal_content[1], $this->tbl_attr['FORM_MODAL']['COLUMN']);
				$form[] = $this->table->make_columns($form_modal_content_join[2], $this->tbl_attr['FORM_MODAL']['COLUMN_JOIN']);
				$form[] = $this->table->make_columns($form_modal_content[2], $this->tbl_attr['FORM_MODAL']['COLUMN']);

				$form_modal_content = $this->table->generate(array_merge($form[0], $form[1], $form[2], $form[3], $form[4], $form[5]));
			/**
			 * @section end form MODAL initalize
			 */


			/**
			 * @section begin generate template variables
			 */
			$return_value = array
				(
					/**
					 * @description form modal dialogs
					 */
					'FORM_MODAL' => array
						(
							'OPEN' => form_open('', array('id' => 'frm_modal', 'onSubmit' => 'return false'), '')
							, 'TITLE' => $this->tbl_attr['FORM_MODAL']['HEADING']
							, 'CONTENT' => $form_modal_content
						)

					/**
					 * @description notes modaldialog
					 */
					, 'NOTES_MODAL' => array
						(
							'USE' => 'TRUE'
							, 'MESSAGE' => array
								(
									'SHORTCUTS' => $this->lang->line('notes_modaldialog_shortcuts')
									, 'ADDITIONAL' => ''
								)
						)
				);
			/**
			 * @section end generate template variables
			 */


			$return_value = $this->M_layout->modaldialog_generate($return_value);
			echo $return_value;
		}
	}


	/**
	 * @function form_modal_employment_general_leave
	 * @description generate the employment general leave modaldialog form
	 */
	public function form_modal_employment_general_leave($prm_employee_id = '')
	{
		if ($this->input->is_ajax_request() && ($this->access_rights['ADD'] OR $this->access_rights['EDIT']))
		{
			/**
			 * @description load the models
			 */
			$this->load->model(array('admin/M_layout', 'admin/hris/HRIS_M_live_data'));


			/**
			 * @section begin form MODAL initalize
			 */
				/**
				 * @description create the MODAL form and elements
				 */
				$form_modal_content = array
					(
						array('data' => '<b>'.$this->lang->line('hris_attendance_leave_leave').'</b><br /><small>'.$this->lang->line('fields_choose_more').'</small>', 'valign' => 'top')
						, form_input
							(
								array
								(
									'type' => 'hidden'
									, 'name' => 'txtinput[70]', 'id' => 'txt70'
									, 'size' => '20', 'maxlength' => '20'
									, 'readOnly' => 'readOnly', 'class' => 'read_only'
								)
							)
							. form_input
								(
									array
									(
										'type' => 'hidden'
										, 'name' => 'txtinput[71]', 'id' => 'txt71'
										, 'size' => '20', 'maxlength' => '20'
										, 'readOnly' => 'readOnly', 'class' => '{validate: {required: true}} read_only do_not_change'
									)
									, $prm_employee_id
								)
							. form_dropdown
								(
									'txtinput[72][]'
									, $this->HRIS_M_live_data->combo_fill('db_default', 'hris_attendance_leave_management', '', 'NORMAL', array(), FALSE, '', FALSE)
									, ''
									, 'id="txt72"'
										. ' multiple="multiple" size="15" style="width: 300px"'
								)
								. '<div align="right">'.anchor('#', $this->lang->line('hris_select_toggle'), array('class' => 'link_select_toggle')).'</div>'


						, '&nbsp;'
						, form_submit
							(
								array('id' => 'btn_modal_save')
								, $this->lang->line('button_save')
							)
					);
				/**
				 * @description create the form MODAL and elements
				 */
				$this->table->clear();
				$form_modal_content = $this->table->make_columns($form_modal_content, $this->tbl_attr['FORM_MODAL']['COLUMN']);
				$form_modal_content = $this->table->generate($form_modal_content);
			/**
			 * @section end form MODAL initalize
			 */


			/**
			 * @section begin generate template variables
			 */
			$return_value = array
				(
					/**
					 * @description form modal dialogs
					 */
					'FORM_MODAL' => array
						(
							'OPEN' => form_open('', array('id' => 'frm_modal', 'onSubmit' => 'return false'), '')
							, 'TITLE' => $this->tbl_attr['FORM_MODAL']['HEADING']
							, 'CONTENT' => $form_modal_content
						)

					/**
					 * @description notes modaldialog
					 */
					, 'NOTES_MODAL' => array
						(
							'USE' => 'TRUE'
							, 'MESSAGE' => array
								(
									'SHORTCUTS' => $this->lang->line('notes_modaldialog_shortcuts')
									, 'ADDITIONAL' => ''
								)
						)
				);
			/**
			 * @section end generate template variables
			 */


			$return_value = $this->M_layout->modaldialog_generate($return_value);
			echo $return_value;
		}
	}


	/**
	 * @function form_modal_additional_job_experience
	 * @description generate the additional job experience modaldialog form
	 */
	public function form_modal_additional_job_experience($prm_employee_id = '')
	{
		if ($this->input->is_ajax_request() && ($this->access_rights['ADD'] OR $this->access_rights['EDIT']))
		{
			/**
			 * @description load the models
			 */
			$this->load->model(array('admin/M_layout', 'admin/hris/HRIS_M_live_data'));


			/**
			 * @section begin form MODAL initalize
			 */
				/**
				 * @description create the MODAL form and elements
				 */
				$form_modal_content[] = array
					(
						'<b>'.$this->lang->line('hris_start').'</b><br /><small>'.$this->lang->line('fields_required').'</small>'
						, form_input
							(
								array
								(
									'type' => 'hidden'
									, 'name' => 'txtinput[70]', 'id' => 'txt70'
									, 'size' => '20', 'maxlength' => '20'
									, 'readOnly' => 'readOnly', 'class' => 'read_only'
								)
							)
							. form_input
								(
									array
									(
										'type' => 'hidden'
										, 'name' => 'txtinput[71]', 'id' => 'txt71'
										, 'size' => '20', 'maxlength' => '20'
										, 'readOnly' => 'readOnly', 'class' => '{validate: {required: true}} read_only do_not_change'
									)
									, $prm_employee_id
								)
							. form_input
								(
									array
									(
										'name' => 'txtinput[72]', 'id' => 'txt72'
										, 'size' => '11', 'maxlength' => '10'
										, 'readOnly' => 'readOnly', 'class' => '{validate: {required: true}} input_calendar do_not_change'
									)
									, date('Y-m-d')
									, 'onBlur="javascript: calendar.hide();"'
								)

						, '<b>'.$this->lang->line('hris_end').'</b><br /><small>'.$this->lang->line('fields_required').'</small>'
						, form_input
							(
								array
								(
									'name' => 'txtinput[73]', 'id' => 'txt73'
									, 'size' => '11', 'maxlength' => '10'
									, 'readOnly' => 'readOnly', 'class' => '{validate: {required: true}} input_calendar do_not_change'
								)
								, date('Y-m-d')
								, 'onBlur="javascript: calendar.hide();"'
							)

						, '<b>'.$this->lang->line('hris_business_line').'</b>'
						, form_dropdown
							(
								'txtinput[74]'
								, $this->HRIS_M_live_data->combo_fill('db_default', 12)
								, ''
								, 'id="txt74" class="{validate: {required: true}}"'
							)

						, '<b>'.$this->lang->line('hris_company_name').'</b><br /><small>'.$this->lang->line('fields_required').'</small>'
						, form_input
							(
								array
								(
									'name' => 'txtinput[75]', 'id' => 'txt75'
									, 'size' => '40', 'maxlength' => '40'
									, 'class' => '{validate: {required: true}}'
									, 'shortcut_f2' => $this->tbl_attr['URL']['VIEW']
								)
							)
					);

				$form_modal_content_join[] = array
					(
						array('data' => '<b>'.$this->lang->line('hris_address').'</b><br /><small>'.$this->lang->line('fields_required').'</small>', 'valign' => 'top')
						, array
							(
								'data' => form_textarea
									(
										array
										(
											'name' => 'txtinput[76]', 'id' => 'txt76'
											, 'cols' => '95', 'rows' => '3'
											, 'class' => '{validate: {required: true}}'
										)
									)
								, 'colspan' => 3
							)

						, '<b>'.$this->lang->line('hris_phone').'</b>'
						, array
							(
								'data' => form_input
									(
										array
										(
											'name' => 'txtinput[77]', 'id' => 'txt77'
											, 'size' => '20', 'maxlength' => '20'
										)
									)
								, 'colspan' => 3
							)

						, '<b>'.$this->lang->line('hris_schema_position').'</b><br /><small>'.$this->lang->line('fields_required').'</small>'
						, array
							(
								'data' => form_input
									(
										array
										(
											'name' => 'txtinput[78]', 'id' => 'txt78'
											, 'size' => '25', 'maxlength' => '25'
											, 'class' => '{validate: {required: true}}'
										)
									)
								, 'colspan' => 3
							)
					);

				$form_modal_content[] = array
					(
						array('data' => '<b>'.$this->lang->line('hris_description').'</b>', 'valign' => 'top')
						, form_textarea
							(
								array
								(
									'name' => 'txtinput[79]', 'id' => 'txt79'
									, 'cols' => '35', 'rows' => '2'
								)
							)

						, array('data' => '<b>'.$this->lang->line('hris_employee_job_experience_achievement').'</b>', 'valign' => 'top')
						, form_textarea
							(
								array
								(
									'name' => 'txtinput[80]', 'id' => 'txt80'
									, 'cols' => '35', 'rows' => '2'
								)
							)

						, '<b>'.$this->lang->line('hris_start').' '.$this->lang->line('hris_employee_job_experience_salary').'</b>'
						, form_input
							(
								array
								(
									'name' => 'txtinput[81]', 'id' => 'txt81'
									, 'size' => '15', 'maxlength' => '15'
									, 'class' => '{validate: {number: true, min: 0}} input_right'
								)
								, '0'
							)

						, '<b>'.$this->lang->line('hris_start').' '.$this->lang->line('hris_status').'</b>'
						, form_dropdown
							(
								'txtinput[82]'
								, $this->HRIS_M_live_data->combo_fill('db_default', 27)
								, ''
								, 'id="txt82" class="{validate: {required: true}}"'
							)

						, '<b>'.$this->lang->line('hris_end').' '.$this->lang->line('hris_employee_job_experience_salary').'</b>'
						, form_input
							(
								array
								(
									'name' => 'txtinput[83]', 'id' => 'txt83'
									, 'size' => '15', 'maxlength' => '15'
									, 'class' => '{validate: {number: true, min: 0}} input_right'
								)
								, '0'
							)

						, '<b>'.$this->lang->line('hris_end').' '.$this->lang->line('hris_status').'</b>'
						, form_dropdown
							(
								'txtinput[84]'
								, $this->HRIS_M_live_data->combo_fill('db_default', 27)
								, ''
								, 'id="txt84" class="{validate: {required: true}}"'
							)

						, array('data' => '<b>'.$this->lang->line('hris_termination').'</b>', 'valign' => 'top')
						, array
							(
								'data' => form_dropdown
									(
										'txtinput[85]'
										, $this->HRIS_M_live_data->combo_fill('db_default', 13)
										, ''
										, 'id="txt85" class="{validate: {required: true}}"'
									)
								, 'valign' => 'top'
							)

						, array('data' => '<b>'.$this->lang->line('hris_description').'</b>', 'valign' => 'top')
						, form_textarea
							(
								array
								(
									'name' => 'txtinput[86]', 'id' => 'txt86'
									, 'cols' => '35', 'rows' => '2'
								)
							)


						, '&nbsp;'
						, form_submit
							(
								array('id' => 'btn_modal_save')
								, $this->lang->line('button_save')
							)
					);
				/**
				 * @description create the form MODAL and elements
				 */
				$this->table->clear();
				$form[] = $this->table->make_columns($form_modal_content[0], $this->tbl_attr['FORM_MODAL']['COLUMN']);
				$form[] = $this->table->make_columns($form_modal_content_join[0], $this->tbl_attr['FORM_MODAL']['COLUMN_JOIN']);
				$form[] = $this->table->make_columns($form_modal_content[1], $this->tbl_attr['FORM_MODAL']['COLUMN']);
#				$form[] = $this->table->make_columns($form_modal_content_join[1], $this->tbl_attr['FORM_MODAL']['COLUMN_JOIN']);
#				$form[] = $this->table->make_columns($form_modal_content[2], $this->tbl_attr['FORM_MODAL']['COLUMN']);

				$form_modal_content = $this->table->generate(array_merge($form[0], $form[1], $form[2]));
			/**
			 * @section end form MODAL initalize
			 */


			/**
			 * @section begin generate template variables
			 */
			$return_value = array
				(
					/**
					 * @description form modal dialogs
					 */
					'FORM_MODAL' => array
						(
							'OPEN' => form_open('', array('id' => 'frm_modal', 'onSubmit' => 'return false'), '')
							, 'TITLE' => $this->tbl_attr['FORM_MODAL']['HEADING']
							, 'CONTENT' => $form_modal_content
						)

					/**
					 * @description notes modaldialog
					 */
					, 'NOTES_MODAL' => array
						(
							'USE' => 'TRUE'
							, 'MESSAGE' => array
								(
									'SHORTCUTS' => $this->lang->line('notes_modaldialog_shortcuts')
									, 'ADDITIONAL' => ''
								)
						)
				);
			/**
			 * @section end generate template variables
			 */


			$return_value = $this->M_layout->modaldialog_generate($return_value);
			echo $return_value;
		}
	}



}

/** End of file profile.php */
/** Location: ./biskitz_mpc/biskitz/controllers/admin/hris/employee/profile.php */
